Reputation: 3791
I am trying to export a table from Matlab to Excel with the names of the rows. Here is a (very) simplified version of my table:
T = table(1,5,2);
T.Properties.RowNames = {'Number'}
T =
Var1 Var2 Var3
____ ____ ____
Number 1 5 2
If I apply Matlab's instructions for exporting a table:
filename = 'data.xlsx';
writetable(T,filename,'Sheet',1,'Range','D1')
it leaves out my row name "Number" and only exports the variables:
Var1 Var2 Var3
____ ____ ____
1 5 2
Is there a way to export a table including row names from Matlab?
Upvotes: 2
Views: 7183
Reputation: 10762
You need to use the WriteRowNames
optional input
writetable(T,filename,'Sheet',1,'Range','D1','WriteRowNames',true)
Upvotes: 6