Writing part of table to an excel file with variable sheet name

2 ビュー (過去 30 日間)
Saber
Saber 2014 年 10 月 10 日
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:
  1. 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.
  2. 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 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by