Unable to save variables and figures of large arrays

21 views (last 30 days)
i keep getting this error:
Warning: Variable 'hgS_070000' cannot be saved to a MAT-file whose version is older than 7.3.
To save this variable, use the -v7.3 switch.
> In matlab.graphics.internal.figfile.FigFile/write (line 32)
In savefig (line 84)
Error using save
Error closing file D:\Dropbox (Personal)\C\Resaults\2018_11_13_21_45_10.926(Temperature map).fig.
Error in matlab.graphics.internal.figfile.FigFile/write (line 32)
save(obj.Path, obj.MatVersion, '-struct', 'SaveVars');
Error in savefig (line 84)
i use this command
the arrays are really big 15000x30000
what is the meaning of this error?
how to avoid it?

Accepted Answer

Stephen23 on 14 Nov 2018
Edited: Stephen23 on 14 Nov 2018
"what is the meaning of this error?"
The .fig file format is really just a .mat that stores all of the objects in a figure. Most of the time this happens quite seamlessly, so the user never notices or cares how .fig files are saved. But .mat files are not all the same: in particular, the size of arrays that can be saved has increased significantly as MATLAB has developed. You can see these differences summarized here:
What appears to have happened is that whoever wrote the .fig saving code did not consider that someone might want to save a figure with such a huge amount of data, and the size is beyond the specification for the default .mat file version that the .fig saving code uses (here in bytes):
>> 2^31
ans = 2147483648
>> 15000*30000*8
ans = 3600000000
"how to avoid it?"
You might like to try using saveas, to see if it handles this better.
Otherwise I doubt that there is a simple solution, but I think you should definitely report this as a bug.
Marc Compere
Marc Compere on 1 Apr 2020
This is the png export of a figure that fails when attempting to write the .fig file. It has subplots and a fair amount of data but it's not unreasonable:

Sign in to comment.

More Answers (0)


Find more on Printing and Saving in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by