read and write data from .mat file

조회 수: 1 (최근 30일)
zozo
zozo 2012년 3월 21일
I have a .mat file containing matrix of size 8x3800000.
I need to read 8x980 matrix twice at a time, process it(overlap add technique of convolution) and write back the processed data into a new file.
That is, at a time my RAM should hold only 2x(8x980) data blocks.
How can I do it efficiently? Please help me with the relevant syntax.
Thank you.

답변 (1개)

Wayne King
Wayne King 2012년 3월 21일
Do you have the DSP System Toolbox? You can use dsp.MatFileReader
For example:
filename = [tempname '.mat']; % Create variable name
originalData = rand(100,4);
save(filename,'originalData','-v7.3'); % Write to MAT file
H = dsp.MatFileReader(filename,'VariableName',...
'originalData','SamplesPerFrame', 25);
Y = step(H);
Each time step() is called you get 25x4 out of the 100x4 matrix.
  댓글 수: 5
Wayne King
Wayne King 2012년 3월 21일
You have to contact MathWorks for that. If your version of MATLAB is on maintenance, you should be able to just download R2012a. I don't know what your licensing situation is, so contact MW.
zozo
zozo 2012년 3월 21일
How can I only write data into file sequencially after processing? For example: At first, I have two blocks of length 1024, I overlap(44 samples in head and tail) and add them, then save(write) the first 1024 in a file. Then I do the same for 2nd and 3rd blocks and save the 2nd block behind the first block (and so on..) How can I do this?

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

카테고리

Help CenterFile Exchange에서 Signal Import and Export에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by