Accessing elements of a large cell array inside a MAT file?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
David Robert Grimes
el 7 de Nov. de 2014
Comentada: David Robert Grimes
el 7 de Nov. de 2014
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!
0 comentarios
Respuestas (2)
Guillaume
el 7 de Nov. de 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.
0 comentarios
Stalin Samuel
el 7 de Nov. de 2014
first load the .mat file.then you will have all the variables in your workspace.Now you can directly access the variables
Ver también
Categorías
Más información sobre Workspace Variables and MAT-Files en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!