I am trying to sort the output data, I need a help to write data into excel file using for loop.
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
dpb
2015 年 8 月 8 日
編集済み: dpb
2015 年 8 月 8 日
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... :)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!