# Format output of a matrix?

Posted 2 years ago
2173 Views
|
3 Replies
|
0 Total Likes
|
 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. Attachments:
3 Replies
Sort By:
Posted 2 years ago
 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}] 
Posted 2 years ago
 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
Posted 2 years ago
 Thank you very much. The code worked for me.
Community posts can be styled and formatted using the Markdown syntax.