Unable to save variables and figures of large arrays

4 visualizaciones (últimos 30 días)
Kobi
Kobi el 13 de Nov. de 2018
Comentada: Marc Compere el 1 de Abr. de 2020
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.
Skipping...
> 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)
FF.write();
i use this command
savefig([time_stamp,'(LASER)','.fig'])
saveas(gcf,[time_stamp,'(LASER)','.png'])
the arrays are really big 15000x30000
what is the meaning of this error?
how to avoid it?

Respuesta aceptada

Stephen23
Stephen23 el 14 de Nov. de 2018
Editada: Stephen23 el 14 de Nov. de 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.
  6 comentarios
Marc Compere
Marc Compere el 1 de Abr. de 2020
Editada: Marc Compere el 1 de Abr. de 2020
I have this same issue on Ubuntu 18 Linux in R2019a.
The savefig command it's still failing with a simple file: /tmp/tmp.fig:
>> saveStr = '/tmp/tmp.fig';
>> savefig(h,saveStr,'compact')
Error using save
Error closing file /tmp/tmp.fig.
The file may be corrupt.
Error in matlab.graphics.internal.figfile.FigFile/write (line 32)
save(obj.Path, obj.MatVersion, '-struct', 'SaveVars');
Error in savefig (line 83)
FF.write();
>>
This appears to be a bug. The other figures of similar complexity generate .fig files less than 0.5Mb. The figures have lots of data but the resulting .fig files are not large for those that work.
Matlab has a resident memory footprint of 12Gb on a machine with plenty of more ram than that. The problem is not lack of physical memory but still this file writing process fails.
The failuse occurrs with and without the 'compact' designator.
Writing to .png files works fine. It's the .fig file format that is the problem.
Any solutions????
Marc Compere
Marc Compere el 1 de Abr. de 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:

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Environment and Settings en Help Center y File Exchange.

Productos


Versión

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by