How do I write a combined cell array/struct to excel in a loop, moving one column over for each iteration?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
My variable Cyc(iiFile).Dch{n} encompasses the file number iiFile and the cycle of discharge (n). For simplicity, I called n = 1. I want to write starting in column B2 for iiFile = 1 and move to C2 for iiFile = 2, etc. Eventually, I will want to add in the 2nd discharge cycle for n = 2 beside each n=1 column vector. The code below works, but keeps overwriting the column vector under cell index B2.
for t = 1:iiFile % for n = 1 to numel( n=1; xlswrite('Test_Data.xlsx',Cyc(iiFile).Dch{n},'Dch','B2') end
0 Commenti
Risposta accettata
Mischa Kim
il 13 Mar 2014
Modificato: Mischa Kim
il 13 Mar 2014
Beverly, use strcat to modify the cell name you need to write to:
C(1).D = 'b'; % some random data
C(2).D = 'c';
C(3).D = 'd';
for ii = 1:3
sheet = 1;
range = strcat(char(65 + ii),'2'); % create excel cell name
xlswrite('Test_Data.xlsx',C(ii).D,sheet,range)
end
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Spreadsheets in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!