How can I save, close, and then reopen a Matlab file later so that I can resume at the same workspace when I closed the file?

조회 수: 18 (최근 30일)
How can I save, close, and then reopen a Matlab file later so that I can resume at the same workspace when I closed the file?
  댓글 수: 3
dhhtr
dhhtr 2015년 5월 8일
편집: dhhtr 2015년 5월 8일
To save the workspace information, in the command window you can input: save('filename')
Conversely, to load the workspace information you can pull it back up by using the syntax: load('filename')

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

채택된 답변

Walter Roberson
Walter Roberson 2015년 5월 8일
How closely does it need to be reproduced? For example does the previous command output have to be brought back? If you were in the middle of debugging something, does the program state need to be recreated and the restoration leaves you ready to pick up where you left off?
Mathworks does not provide any tools able to save everything about a MATLAB session for later restoration. (It can be especially difficult to save and restore the state of files that are in use.)
Is your purpose to be able to save the state of a calculation so that it can be restarted from its last "checkpoint" ?
  댓글 수: 2
Chanchal Sadhu
Chanchal Sadhu 2015년 5월 9일
That is right. I was hoping to be able to save the calculations so that I can resume later from its last point.
Walter Roberson
Walter Roberson 2015년 5월 9일
Mathworks does not provide a general checkpoint facility. The Distributed Computing package does checkpoint its operations automatically, though.
For the case of long computations, see this previous discussion.

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

추가 답변 (1개)

Michael Haderlein
Michael Haderlein 2015년 5월 7일
What do you mean with closing the file?
You can save the workspace with mat-files. save('matfile.mat') will save the current workspace in matfile.mat. load('matfile.mat') will load the respective workspace.
  댓글 수: 2
Chanchal Sadhu
Chanchal Sadhu 2015년 5월 8일
Hi Michael, Thanks a lot for your response. Although the file got saved, the load command did not re-open the "Command" window in the same state as I closed it. The load command only loaded the variables in the "Workspace."
I am looking for ways to reopen my command window as I closed it. Any tips?
Thanks again.
Chanchal
Michael Haderlein
Michael Haderlein 2015년 5월 8일
Yes, mat-files save the workspace, not the command window. You might be looking for the diary function. Not sure if it is possible to reset the command window exactly as it was (or how much effort it would take).

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

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by