Recovering workspace after exiting Matlab
조회 수: 70 (최근 30일)
이전 댓글 표시
Hi guys,
I have made a big mistake by not including a command to save my workspace after my simulation ends. My computer shut down and now I don't have most of the matrices from my simulation results. Is it possible at all to recover my workspace after I exited Matlab without saving them? I've googled this and everybody says it's impossible. Just in case anybody has a different answer.
cheers,
Febrio
댓글 수: 0
채택된 답변
Walter Roberson
2011년 12월 14일
The data is gone. MATLAB keeps workspace contents in memory and does not bother to write the contents to disc unless it is asked to.
추가 답변 (1개)
Michael Melnychuk
2015년 1월 26일
I think the core dev's should consider adding an autosave/recover function.
댓글 수: 3
Stephen23
2016년 2월 2일
편집: Stephen23
2016년 2월 2일
Just imagine the complaints:
"I relied on MATLAB to auto-save my data, but I don't have enough diskspace and it missed some of my data. How do I get this missing data?"
"MATLAB is sooooo sloooow... " (while MATLAB tries in the background to save fifty Gibibytes of data).
"I reverted my workspace to the saved version... but now I changed my mind. How do I get my first workspace back?"
The only complete solution would be to back up every code step and every variable at every change. This works great if you have infinite disk-space and infinite computing power.
A more robust solution is to:
- Stop writing scripts and learn to write functions.
- Stop relying on the base workspace. This workspace is for playing around, not for serious work. Use functions!!!
- Keep track of data and save it when possible. This is easy with functions, as processing can be re-started from the last saved data.
- Avoid amateur commands like clear all. Have a good look at well-written code on MATLAB File Exchange: none of them use clear all. In fact most of them are functions, not scripts. The reason: to encapsulate their functionality and workspace (in other words: to manage their data properly, so that it is not in the base workspace, so that other people cannot mess it up).
- Oh, and learn to use functions instead of scripts.
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!