Can't save workspace of 3 month calculation - URGENT
조회 수: 7 (최근 30일)
이전 댓글 표시
Hi,
I did some scientific simulation on a university server which took more than 3 months. The result worked out great. I wanted to save the workspace so I could continue analyzing on a local machine.... but I can't figure it out!!
I tried
save('data.mat');
which returned
Warning: Variable 'image' cannot be saved to a MAT-file whose
version is older than 7.3.
To save this variable, use the -v7.3 switch.
Skipping...
Warning: java.awt.Robot[ autoDelay = 0, autoWaitForIdle = false ]
is not serializable
Error using save
Can't write file C:\data.mat.
then I read about v7.3 option and tried it like this:
save('data.mat','-v7.3');
which gave me
Warning: java.awt.Robot[ autoDelay = 0, autoWaitForIdle = false ]
is not serializable
Error using save
Can't write file C:\data.mat.
Now I'm at a loss. I really need this data and I can't affort to have to run the 105 days simulation again! Please help me save this workspace somehow. Estimated size is just one GB.
kind regards, Arnold
채택된 답변
arnold
2014년 9월 6일
편집: arnold
2014년 9월 6일
댓글 수: 3
Rodrigo Bezerra
2019년 8월 30일
Here is a suggestion to change the MATLAB configuration to save the MAT-Files using version 7.3 without setting the parameter 'v7.3'. By default MATLAB uses version 7 to save MAT-Files.
"To change your preferences to save new files in Version 7.3 format, access the Environment section on the Home tab, and click Preferences. Select MATLAB > General > MAT-Files. This preference is not available in MATLAB Online™."
추가 답변 (6개)
Image Analyst
2014년 9월 6일
Sounds like perhaps you unwisely chose to have a variable called "image", which is the same as a built in function name. Perhaps save() is getting confused as to which image you want to save. Try renaming that variable. Also try saving things more frequently than every 3 months. At least try saving it after the first iteration so that if something goes wrong you don't have to wait 105 days to find out.
It also sounds like maybe you're trying to save new version MATLAB things into an old version .mat file, which I guess has a different format. Try deleting the existing file first and then saving it so that it creates a brand new one.
댓글 수: 0
arnold
2014년 9월 6일
댓글 수: 2
per isakson
2014년 9월 6일
편집: per isakson
2014년 9월 6일
"Strangely enough"   why strange? The warning indicated that it should work with the -v7.3 switch: "To save this variable, use the -v7.3 switch."
"Warning: java.awt.Robot[ autoDelay = 0, autoWaitForIdle = false ] is not serializable"   is most likely a different problem. Did you use java.awt.Robot? Could there be an instance of that Java class in the work space?
Proposal: Save a few variables at a time until you spotted the variable that causes the problem.
arnold
2014년 9월 6일
댓글 수: 1
Walter Roberson
2015년 5월 4일
-v7.3 saves in HDF files, a standard format that has more overhead than the older format.
My understanding is that HDF files can sometimes have compression for components, but I do not know the circumstances under which that applies. See the discussion here and note that MATLAB might have changed which compression it does automatically since that time.
David
2015년 5월 4일
So... I'm getting this same error, trying to save a struct variable with no ROBOTS in it. I'm surprised that no one can answer the actual question here, which is why version 7.3 has anything to do with saving a brand new mat file with a brand new version of matlab.
Sadly, my 90 hour data run already closed, and all my attempts at intermediate saves errored out with this same -v7.3 garbage.
I don't want any lectures about intermediate saves, or how I should've made sure it was working before a 90 hour run. Just an answer to the question please.
댓글 수: 2
per isakson
2015년 5월 4일
편집: per isakson
2015년 5월 4일
- "this same error"   Please describe the error in some detail. I don't understand what you refer to.
- "same -v7.3 garbage"   What do you mean?
- "surprised that no one can answer the actual question"   What is the actual question?
Walter Roberson
2015년 5월 4일
You need -v7.3 to save any variable that contains an object, or to save a variable whose storage size exceeds 2 Gb.
What are the class() of the elements of your struct variable?
As to why -v7.3 is not the default: -v7.3 results in considerably larger files, and the access to data can be quite a bit slower. In early implementations, there were reports of save() requiring 2+ hours for data that took about 5 minutes to save() with -v7 . Performance improvements have been made, but the time and storage are still a fair bit more.
Most people do not need the extended facilities at all, and even then not most of the time. If a facility is only needed (say) 5% of the time, then does it make sense to penalize performance notably the other 95% of the time?
The people who do need the facility regularly, the people who routinely run with large data sets or with saving objects: those people test their code.
Akhilesh Thakur
2017년 8월 8일
Warning: java.awt.Robot[ autoDelay = 0, autoWaitForIdle = false ] is not serializable
Error using save
Can't write file
These are the errors I got today. But even using v7.3 as it says use for larger files > 2GB this didn't do any effect. I found out that there are timing issues with save. If you are calling save option again and again to update your file, there is an internal error of saving it. Even I am running a huge program that gives me result after 3 days. I found out i was using save command after every iteration of my program. This won't work. I added a functionality where I can manually save the file using flag or keypress. I realised that save command failed after calling it 19 times. I dont know what happens exactly when it is exactly called at 19th time. But the point is whenever you want to save file use a mechanism that will use this command very less frequently. So even if someone wants to save the file and the program is running, You can do a keypress So i did if( handles.keypress == 'p') save('results.mat');
So the conclusion is avoid calling save multiple times. This method worked for me.
Hope this helps.
댓글 수: 1
Akhilesh Thakur
2017년 8월 10일
편집: Akhilesh Thakur
2017년 8월 10일
One more change
I checked only saving the data and filtering out other data such as small variables and handles, so I am only saving required variables in the result like this
save example.mat results
This works for me and never fails. Try filtering out only data which you want. Without handles and other info it is working. I guess it's handles which is messing with java.awt. This is the way where save worked for me for 192 hours of continuous calculations.
Hope this works for everyone. I spent almost 4 days debugging this.
Mech Princess
2018년 11월 27일
So the problem is that there are some variables that are communicating with java. So once it comes to that variable, it stops saving and gives the error
not serializable
Error using save
My workspace has a lot of variables both serializable and not. Does anyone know how to save ignoring the variables not serializable without having to delete it manually or name them one by one?
Thanks
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!