Why does MATLAB hang and/or crash when I try to open a large MAT-file?

I have saved a very large data set in a MAT-file. When I try to open the MAT-file in MATLAB, it stays busy for a long time and then crashes with the following error message:
ERROR: ------------------------------------------------------------------------
Assertion detected at Wed Jan 19 17:57:26 2005
------------------------------------------------------------------------
Assertion failed: Forced Assertion at line 388 of file ".\memmgr\memcache.cpp".
Cache error: base_table is full
Configuration:
MATLAB Version: 7.0.1.24704 (R14) Service Pack 1
MATLAB License: DEMO
Operating System: Microsoft Windows XP
Window System: Version 5.1 (Build 2600: Service Pack 1)
Processor ID: x86 Family 15 Model 2 Stepping 9, GenuineIntel
Virtual Machine: Java 1.4.2_04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM
(mixed mode)
Default Charset: ibm-5348_P100-1997
Stack Trace:
When I tried to see the contents of the file using the following command:
whos -file myfile.mat
I observed the same behavior and the same error message as above.

 Accepted Answer

This enhancement has been incorporated in Release 14 Service Pack 3 (R14SP3). For previous product releases, read below for any possible workarounds:
This issue is a result of MATLAB running out of memory. You can try to load individual variables from the MAT-file to avoid the large memory usage. To find out the names of variables stored in a MAT-file, you can view its contents without loading the variables into memory.
The standard method for doing this is to use the following command:
whos -file myMATfile.mat
This will work for most MAT-files. However, for large MAT-files this may not be suitable as this command tries to parse through the file to generate the information. In such cases, you can use the MAT-file Corruption Analysis Tool (MATCAT) to generate a report on the contents of a MAT-file without parsing through the entire file. You can download this utility from the MATLAB Central File Exchange and use it to examine the contents of a MAT-files:
On the MATLAB Central page, click on the link for "File Exchange" and then search for "MATCAT".
The MATCAT function also returns a binary value that indicates whether the MAT-file is corrupt.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!