append (a row) to the end of an excel sheet
65 ビュー (過去 30 日間)
表示 古いコメント
Hi,
I would like to know if there is any way to simply append to the next available row in an existing excel sheet. I know I can do the append with the writematrix function by specifying the 'Range' property.
writematrix(matrix_to_add, filename, 'Range', 'A1:D20'); %% this adds the matrix_to_add variable in the specified block
However, I do not wish to explicitly specify the range. The rows being added are quite long: 1000 elements. Hence, specifying range will be inconvenient. Thus, the solution I am looking for will simply add the row to the 51st row in the excel sheet if there are already 50 rows in the sheet.
Thanks!
3 件のコメント
Walter Roberson
2021 年 11 月 21 日
If I recall correctly, with new enough versions of MATLAB, if you use writecell() then it will not change the format of existing cells.
回答 (2 件)
Sulaymon Eshkabilov
2021 年 11 月 21 日
This is how you can get it:
FName = 'DATA.xlsx';
for ii=1:5
writematrix(magic(3), FN, 'WriteMode','append')
end
0 件のコメント
参考
カテゴリ
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!