필터 지우기
필터 지우기

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

조회 수: 5 (최근 30일)
David Robert Grimes
David Robert Grimes 2014년 11월 7일
댓글: David Robert Grimes 2014년 11월 7일
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!

답변 (2개)

Guillaume
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.

Stalin Samuel
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
  댓글 수: 1
David Robert Grimes
David Robert Grimes 2014년 11월 7일
Afraid that's not possible - file is so large it crashes this workstation with an out of memory error.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile 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!

Translated by