Format output of a matrix?

I am new to Mathematica and I am stuck with this!

I wrote a code that outputs a matrix and its heading, separately. I want to combine these outputs such that it is easy to be understood. (I.e. I want to re-shape this matrix into a grid/table that has labels to easily understand what does each column refer to).

In the attached file, I want to name the first column in the matrix {1,2} and the second column in the matrix {1,3} and so on.

Trial-Modified path matrix - Second order.nb (125 KB)

A first try (if I understand correctly what you want to do):

Write

colmat = Transpose[Apply[Plus, Subsets[Transpose[pathmatrix], {2}], {1}]];
% // MatrixForm

instead of your statement in your notebook and then at the end

TableForm[colmat, TableAlignments -> Center, TableHeadings -> {None, paths}]

Nehal,

Do you mean this?

Grid[colmat // Prepend[paths], Frame -> All, ItemSize -> All, 
 Background -> {Automatic, {1 -> Yellow}}, 
 ItemStyle -> {Automatic, {1 -> {FontSize -> 14, Bold}}}]

Part of the resulting very large grid

Thank you very much. The code worked for me.