필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

how do i export/save an .xls or .csv file interactively?

조회 수: 1 (최근 30일)
Nahir
Nahir 2013년 5월 1일
마감: MATLAB Answer Bot 2021년 8월 20일
I have written a script to be used on many files with very similar structure. At the end I want to write/export/save a modified version of the file that I imported. I need to change the name of that exported file each time a new one is imported because I don't want it overwritten or appended.
Currently I am using the_ xlswrite_ function: xlswrite('new_file.xls', data);
I have tried using the input function in conjunction with xlswrite because "_input_" allows me to interactively type in a new name in the command window; however, I have not gotten this to work.
Ideally, if subject1 = the file that I'm importing, I would like the exported file to be subject1_modified. I have 20 subjects so would have 40 files when it is all said and done. The name change can be don interactively or within the script.
Any assitance/suggestions would be greatly appreciated. Thanks.
  댓글 수: 2
Matt Kindig
Matt Kindig 2013년 5월 1일
Just dynamically generate the desired Excel filename using sprintf() or similar.
%for example, suppose that the current file is stored in 'yourfile'
yourfile = 'subject1'
xlswrite( sprintf('%s_modified.xls', yourfile), data);
Nahir
Nahir 2013년 5월 1일
Thank you very much, that worked well for my solution. Wasn't even aware of an sprintf fxn but i learn something new everyday.
Thanks again.

답변 (0개)

이 질문은 마감되었습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by