Save function is taking too long and Execution cannot be stopped

80 次查看(过去 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?

回答(1 个)

Amit Dhakite
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
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 CenterFile Exchange 中查找有关 Logical 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by