Hello,
The function MapIndexed can map a function onto a list or array, while passing to the function the part specification of each element it receives as an argument. The code below generates a sample 2D array from previously defined x and y value lists. it then uses MapIndexed to construct a list of {x,y,z} values, where the z values are obtained from the 2D array and the x and y values are obtained from the corresponding values in the x and y value lists.
(* some x and y coordinates *)
xList = {0, 1, 3, 4, 5, 7, 8}/4.;
yList = {1, 3, 4, 7, 9}/4.;
(* make pairs so we can make some data*)
pairs = Tuples[{xList, yList}];
(* make sample 2D data related to the pairs as an example case *)
data = Table[Sin[x y], {x, xList}, {y, yList}];
(* Look up the documentaton on MapIndexed -- this is a function which \
accepts a value in an array and also makes use of the part \
specifications as provided by MapIndexed *)
makeTriplet[z_, {nx_, ny_}] := {xList[[nx]], yList[[ny]], z}
(* Use map indexed to create a list of {x,y,z} triplets using the z \
values in the 2D array, but the x and y values from separate lists *)
indexedData = Flatten[MapIndexed[makeTriplet, data, {2}], 1];
(* Plot the result and see that it makes sense *)
ListPlot3D[indexedData]