Writing part of table to an excel file with variable sheet name
1 view (last 30 days)
Show older comments
I am writing a code that I need to have output as an excel file. Because I need to save some part of table into different excel file then my output is creatied inside a `for` loop. Something like this:
for j=1:5
Table = table(ColAA(:,j),ColBB(:,j),ColCC(:,3*j-2:3*j),ColWW(:,j));
filename_excel = [ name '_N' num2str(1) '_Seg' num2str(j) '.xlsx'];
writetable(Table,filename_excel,'Sheet', j, 'Range','A5');
end
The Table is as
Table =
Var1 Var2 Var3 Var4
____ ____ ____ ____
38 71 176 124
43 69 163 109
38 64 131 125
40 67 133 117
49 64 119 122
I have two question regarding above code:
- The name of the columns are not going to be the original name and it is just because some parts of table are needed. How could I have the original name in output,too.
- The difficult part for me is that I need to save each sheet inside a loop with the same/different name but with a different indices. How could be done this inside that `for` loop?
0 Comments
Answers (0)
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!