필터 지우기
필터 지우기

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 (최근 30일)
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.

답변 (2개)

Sanchali Purandare
Sanchali Purandare 2011년 1월 16일
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 2011년 1월 26일
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

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by