How to save struct datatype to disk

8 views (last 30 days)
Hi,
I have searched around but have not gotten any useful answers. I have a structure, with each element containing a 1x1 cell and another structure. The second structure contains multiple structures each holding doubles of various lengths.
The entire structure takes up about 25 GB of RAM and I would like to save all the contents to disk. I have tried:
save('name.mat' ,'-struct', structname) without luck.
Do I have to do a sort of nested loop to save all contents to disk?
Thanks for the help.

Accepted Answer

Jonathan Sullivan
Jonathan Sullivan on 6 Jan 2012
One other thing to note is that unless you are trying to save it using the most recent .mat file type (v7.3), you are limited to 2 GB. You can only save .mat files larger than 2 GB if you have a 64-bit system and have MATLAB version 7.3 (R2006b) or later. To do so, specify the correct version flag.
Example:
save('name.mat','mystructname','v7.3')
Hope this helps

More Answers (1)

Andrew Newell
Andrew Newell on 6 Jan 2012
What exactly is the problem you are having? If you just want to save the whole structure,
save('name.mat',structname)
will do it. Note that structname should be a string containing the name of your structure, e.g.,
structname='mystructname';

Categories

Find more on Structures in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!