Accessing elements of a large cell array inside a MAT file?

3 views (last 30 days)
I have a huge (~25gb) cell saved in a 7.3 format MAT file, and I want to access just a few entries from it. I tried to write some code to pull out only the data I need, initially using the matfile command to access the data I need;
inputdata = matfile('fullsetrc150.mat');
data_acquired = inputdata.Segframe{1,401}{1,3};
However as I understand it, matfile cannot handle cell operations, so I am stuck with a massively time and memory consuming script like this instead;
inputdata = matfile('fullsetrc150.mat');
chunk = inputdata.Segframe;
data_acquired = chunk{1,401}{1,3};
clear chunk;
This can take literally hours to run and is incredibly inefficient; is there a more clever way to access just the data I need, or must I load the entire cell to pull values from it? Any advice is welcome!

Answers (2)

Guillaume
Guillaume on 7 Nov 2014
Unfortunately, matfile is the only interface that matlab provides to read parts of a mat file. And as the documentation says, it cannot read just part of a cell array.
I would look on the file exchange to see if somebody has a partial loader for cell arrays. Otherwise, I'm afraid you would have to write your own parser, either as a matlab function or a mex file (for performance) based on mathworks' description of the mat file format.

Stalin Samuel
Stalin Samuel on 7 Nov 2014
first load the .mat file.then you will have all the variables in your workspace.Now you can directly access the variables
  1 Comment
David Robert Grimes
David Robert Grimes on 7 Nov 2014
Afraid that's not possible - file is so large it crashes this workstation with an out of memory error.

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!