Can't save workspace of 3 month calculation - URGENT
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
arnold
am 6 Sep. 2014
Kommentiert: Rodrigo Bezerra
am 30 Aug. 2019
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
Akzeptierte Antwort
arnold
am 6 Sep. 2014
Bearbeitet: arnold
am 6 Sep. 2014
3 Kommentare
Rodrigo Bezerra
am 30 Aug. 2019
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™."
Weitere Antworten (6)
Image Analyst
am 6 Sep. 2014
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 Kommentare
arnold
am 6 Sep. 2014
2 Kommentare
per isakson
am 6 Sep. 2014
Bearbeitet: per isakson
am 6 Sep. 2014
"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
am 6 Sep. 2014
1 Kommentar
Walter Roberson
am 4 Mai 2015
-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
am 4 Mai 2015
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 Kommentare
per isakson
am 4 Mai 2015
Bearbeitet: per isakson
am 4 Mai 2015
- "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
am 4 Mai 2015
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
am 8 Aug. 2017
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 Kommentar
Akhilesh Thakur
am 10 Aug. 2017
Bearbeitet: Akhilesh Thakur
am 10 Aug. 2017
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
am 27 Nov. 2018
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 Kommentare
Siehe auch
Kategorien
Mehr zu Workspace Variables and MAT-Files finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!