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

15 次查看(过去 30 天)
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 个评论
Walter Roberson
Walter Roberson 2016-1-22
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.

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2016-1-22
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 个评论
K M Ibrahim Khalilullah
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 2016-1-22
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.

请先登录,再进行评论。

更多回答(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