필터 지우기
필터 지우기

Saving data from the command window

조회 수: 14 (최근 30일)
Graig
Graig 2011년 2월 14일
Hi All,
I have a matlab code, where I need to save the data (as a txt file) at the end. I can save it in a file in the editor itself. Is there any way that I can save the data from the command window? I mean, once run the code, I will asked to save it or not, if say yes, then it will ask me to give a name and then save it.
I appreciate for your help. Graig.

채택된 답변

Walter Roberson
Walter Roberson 2011년 2월 14일
Do you have the data stored in a matrix at the time you would be asking about saving, or is the data to be stored "whatever happened to get written to the command window" including by routines that you have no control over?
If you need to save "whatever appeared in the command window" then you should consider creative use of "diary".
If you have all of the data, then it becomes a matter of using questdlg() and uiputfile()

추가 답변 (2개)

Graig
Graig 2011년 2월 14일
Thanks Walter. Ohh yeah, I have all the data in a matrix form before saving it.

Graig
Graig 2011년 2월 14일
Thanks walter, but I am confused with the uiputfile syntex. How to save variable 'a' in the workspace using uiputfile?
  댓글 수: 1
Walter Roberson
Walter Roberson 2011년 2월 14일
You use uiputfile to determine the directory and file name that the user wants to write to. Then you use fullfile() to split the directory and filename together to produce an absolute path, and then you use the function form of save,
save(ThePathName, 'a')

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

카테고리

Help CenterFile Exchange에서 Dialog Boxes에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by