Reputation: 89
I have a matrix that looks like
2 3 656
6 2 4
23 4 5
I also have an excel file that I imported into a cell array that looks like
Header1 Header2 Header3
How can I concatenate the headers so that I get a final table that looks like
Header1 Header2 Header3
2 3 656
6 2 4
23 4 5
Thanks!
Upvotes: 0
Views: 78
Reputation: 13945
If you don't have access to the table
function you can concatenate vertically the headers and your matrix, which you want to turn into a cell array:
M = {2 3 656
6 2 4
23 4 5}
Headers = {'Header 1' 'Header 2' 'Header 3'}
NewM = [Headers;M]
Now NewM
looks like this:
NewM =
'Header 1' 'Header 2' 'Header 3'
[ 2] [ 3] [ 656]
[ 6] [ 2] [ 4]
[ 23] [ 4] [ 5]
Is that what you had in mind?
Upvotes: 2