Mega Search
23.2 Million


Sign Up

Make a donation  
How can I display matrix with row and colnames.  
News Group: comp.soft-sys.matlab

I have a 2x3 matrix and cell array like below:

matrix = [1,2,3;4,5,6]
rownames = {'10A','20B'}
colnames = {'10C5D,'20C5D',20C5D'}

rownames and colnames was made from sprintf command.

When I tried to make table, it showed errors.
How can I display it in the command window?

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 28-Aug-2016, at 10:14 PM EST
From: Sungwoo Park
 
Re: How can I display matrix with row and colnames.  
News Group: comp.soft-sys.matlab

"Sungwoo Park"  wrote in message 
news:npvnng$41m$1@newscl01ah.mathworks.com...
> I have a 2x3 matrix and cell array like below:
>
> matrix = [1,2,3;4,5,6]
> rownames = {'10A','20B'}
> colnames = {'10C5D,'20C5D',20C5D'}
>
> rownames and colnames was made from sprintf command.
>
> When I tried to make table, it showed errors.
> How can I display it in the command window?

Convert your array into a table using ARRAY2TABLE. Specify the RowNames and 
VariableNames name-value pairs.

-- 
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on 
http://www.mathworks.com 


Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 29-Aug-2016, at 9:58 AM EST
From: Steven Lord