Is there any function in MATLAB 2010 or below versions to print a result (eg: Some matrices) in tabular form? All I got from googling was a table()
function that works only in MATLAB 2013 or above versions. I've got MATLAB 2010 in my machine and it's not practical to download a newer version as it is very large and I'm in a hurry. Thank you.
For Matlab versions 2012 and below,
can use printmat
printmat(yourMatrix, 'yourMatrix', 'ROW1 ROW2 ROW3 ROW4 ROW5', 'COLUMN1 COLUMN2 COLUMN3 COLUMN4 COLUMN5' );
or use
dataset({yourMatrix 'COLUMN1','COLUMN2','COLUMN3','COLUMN4','COLUMN5'}, ...
'obsnames', {'ROW1','ROW2','ROW3','ROW4','ROW5'})
with reference: Display matrix with row and column labels
For Matlab versions 2012 and greater:
Use array2table, which converts an array into a table.
Example:
A = [1 4 7; 2 5 8; 3 6 9];
T = array2table(A)
T =
A1 A2 A3
__ __ __
1 4 7
2 5 8
3 6 9