How to split .mat V4 files into smaller files?

7 次查看(过去 30 天)
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