フィルターのクリア

Error using save: Error closing file

147 ビュー (過去 30 日間)
Bert
Bert 2011 年 10 月 12 日
コメント済み: Ankit Nag 2023 年 6 月 22 日
Hey all,
An instance of a class is filled with a lot of data and than saved to my harddisk.
However, during saving, I get the following error: Error using save: Error closing file dummy.mat
I thought it had to do with a lack of memory, but I've monitored the process during saving and I never run out of RAM, and I know that I have plenty of space left on my harddisk.
Does anyone know what causes this error?
Any suggestions are much appreciated!
  1 件のコメント
Rafael Lopez Campos
Rafael Lopez Campos 2020 年 12 月 17 日
Hi, I had the same problem. I was working my script in a external device, so I fixed it moving my environment in the same device Matlab is installed.

サインインしてコメントする。

採用された回答

Jared
Jared 2011 年 10 月 18 日
Hi Bert,
I ran into the same error message a day or two ago with a struct filled with instances of classes that were similarly filled with lots of data. However, I could see in task manager that the memory use was in fact spiking.
The problem went away when I switched to version 7.3 format from version 7 (change file->preferences->general->MAT-Files or I think add flag '-v7.3' to save). This led me to believe that the memory problems might have had something to do with the form of compression done in mat files in version 7.
However, this does not solve another problem associated with save and load which might also cause some issues (it does for me). MATLAB uses lazy copying to conserve memory, i.e. A = B does not make a new copy of B until some part of A is later changed, e.g. perhaps A(end) = 1. Mat files appear to forget about all of these memory-saving relations, increasing both the size of the save files as well as the space required in memory once the save file is loaded.
Hope this helps! Jared
  16 件のコメント
Alejandro
Alejandro 2023 年 2 月 13 日
Thanks a lot! This was extremely useful! Solved the same problem by using this method!
Ankit Nag
Ankit Nag 2023 年 6 月 22 日
Is there any way to use -v7.3 and yet keep the file size reasonable. I am saving figures plotted from a large data set and faced this issue. I was able to solve it using v7.3 but I am trying to keep them at a manageable file size. Using -v7.3 seems to be doubling the figure's file size.

サインインしてコメントする。

その他の回答 (2 件)

Jonathan Pelham
Jonathan Pelham 2015 年 2 月 17 日
I have had a similar error message. This is a very old q&a. Does anyone know if the answer is still valid?
  1 件のコメント
Ingo Schalk-Schupp
Ingo Schalk-Schupp 2015 年 7 月 21 日
For me, this also did the trick. I was saving using the -v6 switch, and I got the error reproducibly. After I removed it, the error did not occur any longer.

サインインしてコメントする。


Zaki Mohzani
Zaki Mohzani 2016 年 9 月 7 日
Ran into this error today. That error message should be updated to reflect the new 'v7.3' option.
  3 件のコメント
Henrique Costa
Henrique Costa 2017 年 5 月 5 日
or, if you want compression : save('myFile.mat','-v7.3');
Adam Bruce
Adam Bruce 2020 年 11 月 18 日
編集済み: Adam Bruce 2020 年 11 月 18 日
This still works on 2020a. Thanks!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by