How to save each iteration of a loop into the same sheet of an Excel spreadsheet using a mac and the function Mac OSX friendly function xlwrite
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Charles
am 3 Jul. 2018
Kommentiert: Walter Roberson
am 21 Apr. 2019
How I am trying to write the outputs of each iteration of each loop to the same spreadsheet but in different sheets.
Thus if i have 5 iterations, I want the output of the same iteration to be saved to sheet1, the output o the second iteration . be saved to sheet2.....etc..etc
Note I am using a macbook, and this a custom function called xlwrite which works on a mac osx system.
Akzeptierte Antwort
Madeline Gardner
am 3 Jul. 2018
Hello!
Assuming that xlwrite supports the same syntax as xlswrite, which I believe it does, then you can include a third parameter in your function call to identify which sheet in the spreadsheet you would like to write to. This parameter can be a string, but it can also be an integer representing the index of the sheet, which is very convenient when writing to a spreadsheet in a for loop.
Your code will likely follow this general form, though with your own file and variable names:
for i = 1:5
xlwrite('excelTest', M(:, i), i)
end
Hope that helps!
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!