write in multiple rows in excel

조회 수: 5 (최근 30일)
Mohanned Al Gharawi
Mohanned Al Gharawi 2018년 9월 28일
댓글: Mohanned Al Gharawi 2018년 10월 4일
Hello everyone, I have a loop (n=30), each loop gives me different results. I want to write the result of the first loop at the first row in an excel sheet, and when the code goes to the next loop it will give me another set of results and I need these new results to be written at the second row in the excel sheet and the same for the last loop (n=30). I wonder if that possible in the matlab. Thanks in advance.

채택된 답변

Image Analyst
Image Analyst 2018년 9월 28일
Yes. Let's say that you have 100 results at each iteration stored in a row vector. Try this
allResults = zeros(30, 100);
for k = 1 : size(allResults, 1)
theseResults = .... some row vector that you generate somehow ....
allResults(k, :) = theseResults;
end
xlswrite(xlFileName, allResults);
Basically you build up a matrix one row at a time then write the thing all at once in one single call to xlswrite().

추가 답변 (0개)

카테고리

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