Filter löschen
Filter löschen

How to create and name several excel files in a loop?

3 Ansichten (letzte 30 Tage)
Jamal
Jamal am 24 Sep. 2015
Kommentiert: Jamal am 25 Sep. 2015
Hi,
I need to save outputs of my code into excel files. As I need to do it for about 120 cases and may need to repeat it later, I was wondering how I can do this in a loop over the 120 cases saving the result for each case in a seperate excel file. I know that xlswrite creates file, but don't know how to automate it.
Any help is appreciated Jamal

Akzeptierte Antwort

Thorsten
Thorsten am 24 Sep. 2015
Just create a new filename in each loop and write to this file:
filename = sprintf('data%03d.xls', i);
  4 Kommentare
Jamal
Jamal am 25 Sep. 2015
Bearbeitet: Jamal am 25 Sep. 2015
Dear Thorsten, Thank you very much for your help; both worked. I also need to save the 120 experiment in one file in different sheets; any idea how to name sheets based on the experiments name which are integer numbers but not ordinal. the name are those given to the files created as above. Hope this is my last question :)
Yours, Jamal
Jamal
Jamal am 25 Sep. 2015
Dear Thorsten,
I just tried sprintf and it worked for naming sheets in a file.
Many thanks, Jamal

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Image Analyst
Image Analyst am 25 Sep. 2015

Community Treasure Hunt

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

Start Hunting!

Translated by