Why `WriteMode` isn't working while appending data to xlsx?

89 ビュー (過去 30 日間)
Deepa Maheshvare
Deepa Maheshvare 2020 年 5 月 20 日
編集済み: Anthony Phipps 2020 年 10 月 18 日
I'm doing the following
excelFilename = 'someFile.xlsx';
structFieldnames = fieldnames(myStruct); % <--- where myStruct is your struct of data
for k = 1:length(structFieldnames)
fieldname = structFieldnames{k};
writecell(myheaderstruct.(fieldname), excelFilename, 'Sheet', sprintf('%s_matlab', fieldname)); % add header
writematrix(myStruct.(fieldname), excelFilename, 'Sheet', sprintf('%s_matlab', fieldname),'WriteMode','append');
Invalid parameter name: WriteMode.
If 'WriteMode','append' isn't included, the header is overwritten.
Could someone suggest why `WriteMode` isn't working here?
This is a follow up to my previous post here.
writematrix(data.(fieldname), excelFilename,'-append', 'Sheet', sprintf('%s_simgraph', fieldname));
also doesn't work.
Wrong number of arguments. A filename must be provided when supplying additional parameters, and each parameter name must be followed by a value.
I'm using 2109b.


Walter Roberson
Walter Roberson 2020 年 5 月 20 日
  3 件のコメント
Anthony Phipps
Anthony Phipps 2020 年 10 月 18 日
This post is a life saver - thanks


その他の回答 (0 件)




Community Treasure Hunt

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

Start Hunting!

Translated by