Effacer les filtres
Effacer les filtres

write in multiple rows in excel

1 vue (au cours des 30 derniers jours)
Mohanned Al Gharawi
Mohanned Al Gharawi le 28 Sep 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.

Réponse acceptée

Image Analyst
Image Analyst le 28 Sep 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().
  1 commentaire
Mohanned Al Gharawi
Mohanned Al Gharawi le 4 Oct 2018
Thank you so much!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by