Export data to a new raw of an existing Excel

1 view (last 30 days)
Hello,
I would like to know how can I be adding after each run a new row to an existing Excel doc.
Everytime I run it, I get the answer in the same row.
filename = fullfile(pwd,'ResultsOp.xlsx');
[numbers, strings, raw] = xlsread(filename);
allResults = zeros(1,6);
for k=1:size(allResults,1)
lastRow = size(raw,1);
nextRow = lastRow+k;
end
xlswrite(filename, [P],'Feuil',nextRow);

Answers (1)

Cris LaPierre
Cris LaPierre on 19 Oct 2021
I would use writetable with the 'WriteMode' set to 'Append'. 'Overwrite' is the default.

Categories

Find more on Data Import from MATLAB in Help Center and File Exchange

Products


Release

R2016b

Community Treasure Hunt

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

Start Hunting!