フィルターのクリア

How to writematrix with a different sheet name in a for loop matlab

44 ビュー (過去 30 日間)
Rami
Rami 2019 年 4 月 29 日
コメント済み: Rami 2019 年 4 月 29 日
I have the following vector of arrays
AzizSheetName ={'Joint Angle R.Ankle.X', 'Joint Angle R.Ankle.Y', 'Joint Angle R.hip.X', 'Joint Angle R.hip.Y', 'Joint Moment R.Ankle.X', 'Joint Moment R.Ankle.Y', 'Joint Moment R.hip.X', 'Joint Moment R.hip.Y'};
and there shall be the names of the sheets of a xlsx file that I would like to create
for j=1:numel(sheet_name)
writematrix(NewData{j},Newfilename,AzizSheetName(j))
end
Obviously this does not work, and this is the one that works
for j=1:numel(sheet_name)
writematrix(NewData{j},Newfilename,'Sheet',j)
end
However, I do not want things to be named sheet 1, sheet 2, ect.
Can someone help me please?

採用された回答

Jan
Jan 2019 年 4 月 29 日
What about
AzizSheetName ={'Joint Angle R.Ankle.X', 'Joint Angle R.Ankle.Y', 'Joint Angle R.hip.X', 'Joint Angle R.hip.Y', 'Joint Moment R.Ankle.X', 'Joint Moment R.Ankle.Y', 'Joint Moment R.hip.X', 'Joint Moment R.hip.Y'};
for j=1:numel(sheet_name)
writematrix(NewData{j}, Newfilename, 'Sheet', AzizSheetName{j});
% ^^^^^^^ ^ ^ curly braces
end
"Obviously this does not work" - instead of such a general statement, a copy of the complete error message would reveal some details.
  1 件のコメント
Rami
Rami 2019 年 4 月 29 日
Thank you for that, but it is still creating a 3 empty sheet with sheet1, sheet2, sheet3... How may I get rid of it?

サインインしてコメントする。

その他の回答 (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