How to split .mat V4 files into smaller files?

8 visualizzazioni (ultimi 30 giorni)
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 Commenti
Jan
Jan il 1 Ott 2013
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 il 10 Ott 2013
Modificato: Pico Technology il 10 Ott 2013
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.

Accedi per commentare.

Risposta accettata

Pico Technology
Pico Technology il 10 Ott 2013
Modificato: Pico Technology il 10 Ott 2013
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:

Più risposte (0)

Categorie

Scopri di più su Data Import and Analysis in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by