I am trying to sort the output data, I need a help to write data into excel file using for loop.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying this, but the excel file is getting rewritten for every iteration and values in the cell are getting replaced. I don't know how to replace the "A2" and "B2" with 'AN' and 'BN' so that for the first iteration the values are written into file's A1, B1 cells respectively... "
u_real = real(u);
v_real = real(v);
for n = 1:100000
if and(u_real>0, v_real>0)
xlswrite('new.xlsx',u_real(n),'sheet1','A2');
xlswrite('new.xlsx',v_real(n),'sheet1','B2');
end
0 Kommentare
Akzeptierte Antwort
dpb
am 8 Aug. 2015
Bearbeitet: dpb
am 8 Aug. 2015
See the manner in which the sequential file names are generated in How_can_I_process_a_sequence_of_files? Same idea for the cell indices as function of the loop index variable. NB: you can also increment the characters if changing columns by addition in Matlab. That is,
>> char('A'+10)
ans =
K
>>
Of course, if you were to go past 'Z' you'll have to build the two-character indices; Matlab isn't that clever or tied to Excel... :)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!