Search code examples
matlabsavemat-file

MATLAB - Warning: Variable 'vol' cannot be saved to a MAT-file whose version is older than 7.3?


I have a 800x6 cell array vol, whose 1st to 5th columns are double and 6th column is a 200x200x200 3D double matrix. I am trying to save it to a variable, a .mat file more specifically.

>> save('./vol.mat', 'vol');
Warning: Variable 'vol' cannot be saved to a MAT-file whose version is older than 7.3.
To save this variable, use the -v7.3 switch.
Skipping... 

Why is it so? How should I fix it?

P.S.: I feel rather reluctant to save this cell array as a text file, as doing so sort of "destroys" the structure.


Solution

  • I guess this is attributed to the data type you are using. Just try what the error message suggests:

    save('./vol.mat', 'vol', '-v7.3')
    

    Version 7.3 of the .mat file format is actually newer than the default version ('-v6'). It has the drawback that it lacks backward compatibility with very old matlab versions, is said to be only available on 64bit systems and is said to be solw. Apart from that I see no reason not to use '-v7.3'.

    BTW, I think you can strip the './' and .mat, as these are the defaults, so

    save('vol', 'vol', '-v7.3')
    

    should also work (it does so for me in a similar situation).