How to split .mat V4 files into smaller files?

조회 수: 7 (최근 30일)
Pico Technology
Pico Technology 2013년 10월 1일
편집: Pico Technology 2013년 10월 10일
Hi,
We have an application that exports data collected by oscilloscopes to .mat v4 format.
Unfortunately this format has a limit of 100 million elements per array. Our application can save more than this number to a file resulting in an error.
Is there a way to split the existing data files in MATLAB? I've tried the following:
m = matfile('VSL023.mat')
Warning: Unable to read some of the variables due to unknown MAT-file error.
> In MatFile>MatFile.genericWho at 209 In MatFile>MatFile.whos at 309 In MatFile>MatFile.MatFile at 422 In matfile at 75
m =
matlab.io.MatFile
Properties:
Warning: Unable to read some of the variables due to unknown MAT-file error.
> In MatFile>MatFile.genericWho at 209 In MatFile>MatFile.whos at 309 In MatFile>MatFile.disp at 536
If I try using the splitmat function file from 'How do I recover data from a corrupt MAT-file? ' I get
Error using fread Out of memory. Type HELP MEMORY for your options.
Error in splitmat (line 18) data = fread(f, h2(2));
The mat file is around 800MB.
I'm using MATLAB 2013a 64-bit on Windows 8:
Maximum possible array: 4701 MB (4.930e+09 bytes) * Memory available for all arrays: 4701 MB (4.930e+09 bytes) * Memory used by MATLAB: 586 MB (6.143e+08 bytes) Physical Memory (RAM): 3017 MB (3.164e+09 bytes)
Thanks,
  댓글 수: 2
Jan
Jan 2013년 10월 1일
I do not understand the problem completely. You have an application which has written files, which should actually have the MAT v4 format, but because the application writes more data than allowed, the files are not recognized by Matlab anymore. Is this correct? Are you sure, that the corruption of the format did not overwrite important data? Or in other words: Do you have an evidence, that the data can be extracted from the files correctly? If not, they are garbage.
Pico Technology
Pico Technology 2013년 10월 10일
편집: Pico Technology 2013년 10월 10일
That's correct - the data is not recognised anymore because the array length is greater than 100 million elements.
Mathworks Tech Support advised that the limit is 100 million elements.

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

채택된 답변

Pico Technology
Pico Technology 2013년 10월 10일
편집: Pico Technology 2013년 10월 10일
This is now solved - an existing application that converts the file to text was edited to use the MATLAB API to write data to file:

추가 답변 (0개)

카테고리

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