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

 채택된 답변

Thorsten
Thorsten 2015년 9월 24일
Just create a new filename in each loop and write to this file:
filename = sprintf('data%03d.xls', i);

댓글 수: 4

Jamal
Jamal 2015년 9월 24일
편집: Jamal 2015년 9월 24일
Dear Thorsten,
Thank you very much for your swift reply. I am still struggling how to use the new filename in xlswrite('Path\filename',header4,sheet,xlRange); for example. how could be a variable thing in this command?
Cheers, Jamal
Thorsten
Thorsten 2015년 9월 24일
편집: Thorsten 2015년 9월 24일
xlswrite(fullfile('your_path_here', filename), header4, sheet, xlRange),
Jamal
Jamal 2015년 9월 25일
편집: Jamal 2015년 9월 25일
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
Dear Thorsten,
I just tried sprintf and it worked for naming sheets in a file.
Many thanks, Jamal

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2015년 9월 25일

0 개 추천

댓글 수: 1

Image Analyst,
Thanks for the link. looks very useful.
Jamal

댓글을 달려면 로그인하십시오.

카테고리

질문:

2015년 9월 24일

댓글:

2015년 9월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by