Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MAT file size larger than workspace variable size

7,439 views
Skip to first unread message

Tom

unread,
May 13, 2011, 3:46:06 PM5/13/11
to
I have MATLAB 2011a.

I have a cell array in MATLAB. Each cell contains a struct. The structs do not have all the same fields.

The "who" command tells me that the size of the struct is about 100 megabytes.

I do a command: save('result.mat', 'mycellarray');

The resulting file "result.mat" is 9 gigabytes in size. A factor of 90 larger than the array size in the MATLAB workspace. Why is this? Any help in understanding this would be appreciated.

Malcolm Lidierth

unread,
May 13, 2011, 6:22:02 PM5/13/11
to
Each element of the cell array has a header that provides details of the struct that it contains: field names, types, size etc. You seem to have more header data than data.

Tom

unread,
May 14, 2011, 1:05:05 AM5/14/11
to
The cell array has 250 elements. Each struct has roughly 10 fields. 9.5 GB to hold this header information seems a little excessive. I am not sure if this is the right answer. Can you point me to some documentation that specifies how this information is stored in a MAT file? If it truly consumes 9.5 GB then perhaps I can submit a bug/feature request to Mathworks.

"Malcolm Lidierth" wrote in message <iqkaua$99v$1...@newscl01ah.mathworks.com>...

Pekka Kumpulainen

unread,
May 14, 2011, 4:57:05 AM5/14/11
to
"Tom" wrote in message <iql2i1$fde$1...@newscl01ah.mathworks.com>...

> The cell array has 250 elements. Each struct has roughly 10 fields. 9.5 GB to hold this header information seems a little excessive. I am not sure if this is the right answer. Can you point me to some documentation that specifies how this information is stored in a MAT file? If it truly consumes 9.5 GB then perhaps I can submit a bug/feature request to Mathworks.
>
> "Malcolm Lidierth" wrote in message <iqkaua$99v$1...@newscl01ah.mathworks.com>...
> > Each element of the cell array has a header that provides details of the struct that it contains: field names, types, size etc. You seem to have more header data than data.

Do you have the HDF5-based version 7.3 as default MAT-file format (preferences -> General -> MAT-files)?
That format creates HUGE files from cells and structs.

Tom

unread,
May 14, 2011, 3:00:21 PM5/14/11
to
When I am back at my work computer on Monday I'll check. Assuming it is set as you say, how would you recommend changing it to reduce the file size of these cell/struct arrays?

"Pekka Kumpulainen" <pekka.nospam...@tut.please.fi> wrote in message <iqlg51$n6t$1...@newscl01ah.mathworks.com>...

Tom

unread,
May 17, 2011, 2:50:08 PM5/17/11
to
I was indeed using the 7.3 HDF5 version. Would you recommend switching to the "Version 7 -v7.0" version?

"Tom" wrote in message <iqmjg5$2fj$1...@newscl01ah.mathworks.com>...

Pekka Kumpulainen

unread,
May 21, 2011, 2:40:04 PM5/21/11
to
"Tom" wrote in message <iqug10$941$1...@newscl01ah.mathworks.com>...

I have -v7 as default at the moment. Just try out and see what happens.

chuco...@gmail.com

unread,
Jul 19, 2012, 9:37:42 AM7/19/12
to Pekka Kumpulainen
Hey,guys, is the problem solved? If you use the -v7, what you can preserve is at most 2G. Any suggestion, if I get the content bigger than 2G under the -v7?

0 new messages