loop iteration of table in excel
3 views (last 30 days)
Show older comments
Hashvi Sai on 27 Jul 2021
Commented: Peter Perkins on 28 Jul 2021
Im new to matlab.
I have a complex program of EEG data analysis. i get 6 outputs, each of which needs to be written in a different sheet in excel, without erasing the previous. which is the best suitable function? can someone pls help me with the code
Albert Bing on 27 Jul 2021
xlswrite(filename, Data, sheet)
A = randn(4,3,6);
filename = 'test.xlsx';
xlswrite(filename, A(:,:,i), i);
Peter Perkins on 28 Jul 2021
xlsread and xlswrite are NOT recommended any more. readtable/writetable or readmatrix/writematrix are the way to go.
Dave B on 27 Jul 2021
How about writetable? It has a 'Sheet' option:
Dave B on 28 Jul 2021
The writetable documentation page has an example with appending, I looks like it's as easy as specifying 'WriteMode', 'append' with the command but I haven't tried it. You can also write directly to a specific range. writetable has lots of options and a great documentation page with several examples, I recommend having a look !
(Alternatively, you could read, append, and write the whole thing, or you could try the xlsappend file exchange submission which looks quite popular)
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!