Recovering workspace after exiting Matlab
66 ビュー (過去 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!