Out of memory error: problem loading large .mat file
이전 댓글 표시
Hi,
I have a .mat file containing just one big Simulink.ModelDataLogs variable. The names are "myfile.mat" and "mylogsout".
When I try to load this .mat file into the workspace, I receive the error:
"Out of memory. Type HELP MEMORY for your options".
I tried to use the "matfile" command, as
matObj = matfile('myfile.mat');
but this way I can't acess the inner variables in "mylogsout", as
data = matObj.mylogsout.Signal_In.Force.Data;
I want to find a way to load only the variables from the "mylogsout" file that I will use in script.
How can I load only specific variables of the "mylogsout" file? Is it possible?
Thanks,
Marcelo
댓글 수: 5
per isakson
2015년 1월 8일
Marcelo
2015년 1월 9일
Titus Edelhofer
2015년 1월 9일
BTW, are you using a 64 bit version of MATLAB or 32 Bit? 64 would definitely help. If this is already the case, you can either add more memory (RAM/virtual RAM through harddisk), or load the file on a larger machine, split the variable in multiple variables and save again ...
Titus
Marcelo
2015년 1월 9일
Sean Little
2019년 11월 11일
I am having the same problem, with almost the same situation. I have a matfile with a lot of simulink simulation data (72G) that I am trying to load using the MATFILE command. I thought that was the whole point of using the MATFILE command instead of LOAD...to avoid loading the whole file into memory at once? But it appears to be attempting to load the entire 72G file into memory on my 16G machine, and matlab just crashes and exits silently.
I'm using 64 bit matlab.
Is this a bug or expected behavior?
답변 (1개)
Jan
2015년 1월 9일
1 개 추천
The message means, that the computer does not have enough free memory to store the variable. Is it possible to free memory e.g. by clearing unused variables or stopping other applications? Increasing the virtual memory can help also, but the best method is installing more RAM.
It is possible to create a MEX function, which imports specific fields of a struct only. But I'm convinced that the development and testing is more expensive than buying 4GB of additional RAM.
댓글 수: 3
Marcelo
2015년 1월 9일
Tan Nguyen
2021년 2월 3일
Dear Jan,
All variables in Workplace could be saved as a .mat file. It is about 1.2GB. However, as I load it, it is opened incompletely. Some variables miss. Matlab warns "Out of memory". How can it be fixed?
I am using 128GB RAM.
Thank you,
Jan
2021년 2월 3일
If Matlab runs out of memory, either the arrays occupy much more memory than the MAT files. This is possible, because MAT files are compressed such that zeros(1,1e9) does not need 8e9 bytes in the MAT file. Or the RAM is exhausted by other data already, such that even 1.2MB do not fit anywhere.
Check the contents of the MAT file and the available RAM. Use:
whos
whos -file YourFile.mat
카테고리
도움말 센터 및 File Exchange에서 Workspace Variables and MAT Files에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!