How to write data in an excel sheet with one separate column for each iteration in a for loop?
4 次查看(过去 30 天)
显示 更早的评论
I have a matlab script that has a for loop for 50 iterations. For each iteration the output is a 4097x1 matrix. I want to write each iteration in a separate sequential column so that at the end I have a 4097x50 matrix in the same excel sheet.
Please note that in the script the output is also getting as one row for all the iterations (that means 204850 rows (4097x50=204850)). If I can get all the results in a matrix form 4097x50 in matlab that also will do the purpose.
Can anyone please help me on this??
Thank You.........!!!!
0 个评论
采纳的回答
Image Analyst
2014-11-24
output = zeros(4097, 50); % Preallocate
for iteration = 1 : 50
output(:, iteration) = GetColumnVector(); % Stuff your 4097 elements into one column.
end
xlswrite(filename, output, 'A1');
2 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!