What determines the size of .fig files

20 views (last 30 days)
Jens
Jens on 7 Oct 2014
Answered: matt dash on 9 Oct 2014
Hello all, my question in a nutshell is the following:
What determines the size of matlab's fig files? I encountered an extreme increase in the size of my figure files and I would like to know which I might have changed.
Long version:
I am currently facing the problem that, after coming back from holidays, the figures I am saving with matlab increased in size about 50-fold.
I am working with brain imaging data and use "fieldtrip" to produce 3D images of brain activation. The data sets used for plotting are and have always been huge (200 - 5000 MB), however the resulting figures have always been tiny (2 - 5 MB).
Lately - and I can't think of any reason for it - the .fig files I am saving are almost as large as the original datasets I am plotting (and also larger for large datasets although the resulting 3D image should be the same independent of the dataset size). I noticed this because Matlab suddenly asked me to add the -v7.3 switch to my save command because the file size started to exceed 4 GB (while being less than 5 MB before).
Since my problem may be specific for the datasets I am plotting (and I cannot post 4GB datasets or figures here) I phrased the above question in a very general way. With your answers I might be able to solve my problem.
I use Matlab 2013b and Matlab 2013a, the issue occurs with both. My figures are plotted using ft_sourceplot (fieldtrip toolbox) on a UNIX and a Windows system.
Thanks for your help, maybe you can even comment on my actual problem or on what kind of info I should post to give more insight into the problem.
Jens
  4 Comments
Jens
Jens on 7 Oct 2014
@ cyclist: Thanks for the remark. I tested it and the issue comes up with both.
Jens
Jens on 9 Oct 2014
Edited: Jens on 9 Oct 2014
Here is my code used for plotting. However, since this uses code from fieldtrip, I don't think it can be very helpful:
cfg = [];
cfg.method = 'surface';
cfg.funparameter = 'avg.pow';
cfg.maskparameter = cfg.funparameter;
cfg.funcolormap = 'jet';
cfg.projmethod = 'nearest';
cfg.surfdownsample = 5;
ft_sourceplot(cfg,data)
To my knowledge, this code did not change the problem came up, neither did the plotting function, so I don't think this is the problem.
Thanks for your help, Jens

Sign in to comment.

Answers (1)

matt dash
matt dash on 9 Oct 2014
Last I checked, saving a figure works like this: 1) use handle2struct(f) to create a structure from the figure 2) this structure is saved using the plain old "save" function, but with the extension .fig instead of .mat.
You can use handle2struct and examine the resulting structure to see what is big... though i sounds like you already know it's the data in whatever you're plotting. The structure is really just storing "get(h)" on every handle in the figure. Then you'll get whatever compression "save" does, which i think it similar to a zip file.

Categories

Find more on Wavelet Toolbox 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!