3d Table to 2d table

I have generated a Table in 3 dimensions, for two variables x, y.

grid = {{{1, 1}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}}, {{1, 0}, {1,
1}, {1, 2}, {1, 3}, {1, 4}, {1, 5}}, {{2, 0}, {2, 1}, {2, 2}, {2,
3}, {2, 4}, {2, 5}}, {{3, 0}, {3, 1}, {3, 2}, {3, 3}, {3, 4}, {3,
5}}, {{4, 0}, {4, 1}, {4, 2}, {4, 3}, {4, 4}, {4, 5}}}

and I have computed values for each point using Map[myFunction[#[[1]], #[[2]]] &, grid, {2}], which has given me

myOutput = {{-3.8627*10^-23, 0.000246833, 3.08541*10^-8, 2.57117*10^-12,
1.60698*10^-16, 8.03492*10^-21}, {0., -3.8627*10^-23, 0., 0., 0.,
0.}, {0., 0., 0., 0., 0., 0.}, {-1.8303*10^-26, 0., 0., 0., 0.,
0.}, {0., 0., 0., 0., 0., 0.}}

I have the grid in Dimensions {5,6,2} and my values in Dimensions {5,6}. I would like to have a plain but readable table that has one one axis one dimension of the grid, on the other the other dimension, and the table cells containing the function values. Basically a ListPlot3d, but not as a plot, but with numbers. How can I achieve that?

=================

  

 

Isn’t MatrixPlot[ ] or ArrayPlot[ ] what you’re after?
– Dr. belisarius
Sep 25 ’15 at 15:02

  

 

Or even Grid[ ]
– Dr. belisarius
Sep 25 ’15 at 15:03

  

 

@belisarius MatrixPlot and Grid both are almost there, but I can’t find a way to add the grid (the coordinates from grid) to the picture.
– FooBar
Sep 25 ’15 at 15:18

  

 

Well you don’t really have a grid: some coordinates are missing (e.g., (0,0)), and others are duplicated. (e.g., (1,1)).
– Alan
Sep 25 ’15 at 15:27

  

 

@Alan my calculations are not valid on the (0,0) point, so that was my quick-and-dirty solution to that. If this is an issue, feel free to replace the first (1,1) with (0,0) again.
– FooBar
Sep 25 ’15 at 15:28

=================

2 Answers
2

=================

grid = Flatten[grid, 1]
myOutput = Flatten[myOutput, 1]
stubs = Sort@DeleteDuplicates[Map[First, grid]]
headers = Sort@DeleteDuplicates[Map[#[[2]] &, grid]]
MapThread[Rule, {grid, myOutput}]
Table[{i, j}, {i, stubs}, {j, headers}] /. % /. {_, _} -> Null
TableForm[%, TableHeadings -> {stubs, headers}]

TableForm[myOutput, TableHeadings -> {Range[0, i – 1], Range[0, j – 1]}]