Accessing elements of a large cell array inside a MAT file?
5 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
Guillaume
2014 年 11 月 7 日
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 件のコメント
Stalin Samuel
2014 年 11 月 7 日
first load the .mat file.then you will have all the variables in your workspace.Now you can directly access the variables
参考
カテゴリ
Help Center および 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!