Help me Please.. I want to save a cell array with large data as a mat file, but producing the following error!!

12 Ansichten (letzte 30 Tage)
Warning: Variable 'IMGDB' cannot be saved to a MAT-file whose version is older than 7.3. To save this variable, use the -v7.3 switch. Skipping...
  3 Kommentare
K M Ibrahim Khalilullah
K M Ibrahim Khalilullah am 22 Jan. 2016
Thanks for reply >> I am confused, May be the -v7.3 save as compress file, Is that right?
Walter Roberson
Walter Roberson am 22 Jan. 2016
Compression in -v7.3 is not an easy question to answer. It probably will not happen for you.
The point of the -v7.3 is that it is a format that uses larger internal fields for sizes. The old -v7 format used signed 32 bit numbers, so it was restricted to storing arrays that were no more than (2^31 - 1) bytes, which is 2 gigabytes. I do not know the sizes used for -v7.3 but I would expect it uses either 48 bit counters or else 64 bit counters, so it knows how to store up to petabytes of memory.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 22 Jan. 2016
The variable is either too large to fit in an older .mat format, or else you are trying to store a style of Objects that is too new to be supported with the older .mat format.
You can either add the -v7.3 option to your save command
save YourFile IMGDB -v7.3
or you can go into your Preferences to General to MAT-Files and set your preference to 7.3 there. Note that if you change your preference, then all of your save() will start using 7.3 even for small items.
  2 Kommentare
K M Ibrahim Khalilullah
K M Ibrahim Khalilullah am 22 Jan. 2016
Thanks for your answer. >>if I use the command "save YourFile IMGDB -v7.3", Is there any bad effect on the data (e.g. compression)?
Walter Roberson
Walter Roberson am 22 Jan. 2016
That is a difficult question to answer. It depends exactly what the data type is, and it depends upon which MATLAB version you are using, and it depends upon the exact order that you save variables in the .mat file.
Generally speaking, -v7.3 is less likely to compress data. Sometimes the files it produces are surprisingly large. The data will, however, be restored intact -- it never uses "lossy" compression.
You probably want to avoid using -v7.3 if you are storing only numeric variables (or cell arrays of strings) and the largest variable you have is smaller than 2 Gb.
If you have a variable which is more than 2 Gb, or if you have a variable that includes some kinds of objects that had not been invented at the time -v7 was designed, then your choices are:
  • use -v7.3, or
  • do not save the data at all; or
  • find some library or database that can do the storage for you; or
  • invent your own storage mechanism.
To emphasize: MATLAB cannot save() sufficiently large items in -v7 save files, and it cannot save() some kinds of object-oriented objects in -v7 save files. If you have big items or you have some of the newer Objects, then you use -v7.3 because you have to. If the choice is between saving uncompressed but saving it, or not being able save at all because your file is too big to handle for the old scheme, then you should probably save using the new -v7.3 scheme.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by