Filter löschen
Filter löschen

How do I generate the range of data to be written to in an excel sheet dynamically when using XLSWRITE in a loop in MATLAB 7.9 (R2009b) ?

8 Ansichten (letzte 30 Tage)
I would like to write to a new range of data cells in an excel sheet, based on the loop index (with a for loop), dynamically.

Antworten (2)

Sanchali Purandare
Sanchali Purandare am 16 Jan. 2011
GENVARNAME can be used to dynamically generate the range of cells to which data is written, in the following manner:
A = [1 2 3; 4 5 6]
for i = 1:2
varname = genvarname(['A' i]);
xlswrite('testing.xls',A(i,:),'Sheet1',varname);
end

Richard de Garis
Richard de Garis am 26 Jan. 2011
If it helps, I just published a function on the File Exchange that will enable you to calculate Excel ranges if you know your start cell (or range), the row and column offsets and the row/column size you want. http://www.mathworks.com/matlabcentral/fileexchange/30180-calculate-excel-range

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by