Save function is taking too long and Execution cannot be stopped
89 次查看(过去 30 天)
显示 更早的评论
I'm trying to save some very large variables and testing out various ways of saving them that might best work for my workflow.
However often the save function ends up doing nothing and the command is not completed and cannot be broken with CTRL+C forcing me to force quit matlab with the task manager, which then means many hours of reloading the data back into the workspace (which is why I want to save these variables in the first place)
When you force quit matlab a window pops up and asks if I want to "stop now and exit". Is there any way to utilise this stop now aspect without actually exiting and losing the workspace?
0 个评论
回答(1 个)
Amit Dhakite
2023-6-5
Hi Nadav,
As per my understanding, you want to save very large variables in a file, but the operation is not completed and takes too long.
For your query regarding force quitting MATLAB, unfortunately there is no way to preserve the variables after the MATLAB closes, unless the process of saving them completes.
However, to improve the speed of saving large variables in a file, you may want to consider utilizing a 3rd party function called “savefast()”.
Please keep in mind that while this function has been developed and shared by a MATLAB user on the MathWorks File Exchange, it is not a built-in part of MATLAB and is not directly supported by MathWorks. You can learn more about "savefast()" and its applications through the link provided here: https://www.mathworks.com/matlabcentral/fileexchange/39721-save-mat-files-more-quickly
1 个评论
Walter Roberson
2023-6-5
Or you could
save(FileName, Variables..., '-v7', '-nocompression')
If you are saving large enough objects you would need -v7.3
Note that -v7.3 is generally significantly slower than -v7 if you have struct or cell array or any other composite datatype
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!