How to recover an unsaved "untitled2.m" script after computer crashed
327 次查看(过去 30 天)
显示 更早的评论
I have been working in an unsaved "untitled2.m" script when my computer crashed.
When restarting matlab this unsaved document was gone along with the .asv files in my current directory.
However, when opening a new script I noticed that the new scripts filename is "untitled3.m", which means that somewhere the "untitled2.m" document must exist. The question is where? I assume this is some temporary folder created somewhere while matlab is still running. But how do I access this folder/file using Macbook.
0 个评论
回答(3 个)
Codey Nacke
2024-9-2
I had a similar issue and was able to recover the code. I had an untitled file that I was working on and hadn't yet saved when my power went out. I was able to find the script in the temp folder.
First, navigate to where Matlab is storing temp files by running tempdir then navigating to that folder in your file system.
Next, I found a folder called "Editor_wtfiy" that had a file called "LiveEditorEvaluationHelperE1112034879.m" that had a copy of my code. I assume that the "E1112034879" is a unique identifier for each script.
TLDR: Look in ~tempdir~/Editor_wtfiy/LiveEditorEvaluationHelper[...].m
Walter Roberson
2023-3-2
However, in practice that directory is used for MATLAB mostly to store files being built into a .slx or .xlsx, or code extracts when running LiveScript or running regular script section by section ("Run and Advance")
You could also look under ~/Library/'Application Support'/MathWorks/MATLAB but I don't think you will find anything useful there.
Time to invoke Time Machine.
2 个评论
Walter Roberson
2023-3-3
The file name might hypothetically be handled by something recorded in prefdir .
I just tested on my system, creating some untitled files and deleting them all. The next file had the next sequence number. (At least within the same session; I did not test closing MATLAB.)
Praprara
2024-9-16
Lol I came to this page 2 months ago for this same issue but since you hadn't commented, I wasn't been able to get back the file. But seeing this comment now, I finally know how to retrieve 'lost' matlab files. Thank you!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!