write in multiple rows in excel

3 visualizaciones (últimos 30 días)
Mohanned Al Gharawi
Mohanned Al Gharawi el 28 de Sept. de 2018
Comentada: Mohanned Al Gharawi el 4 de Oct. de 2018
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.

Respuesta aceptada

Image Analyst
Image Analyst el 28 de Sept. de 2018
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().

Más respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by