MATLAB: Can’t replace the existing struct in a Mat file

matMATLAB

I am working on a project and have saved many data along the way in a Mat file which is like a database for me. However, starting from yesterday, I have difficulty changing the values of existing struct variables in the Mat file which is currently less than 600MB in size.Detailed structure of the Mat file is at the bottom.
In my codes, I use
mReadable = matfile(datafullfile, 'Writable',true);
so that I don't have to load all of Mat file variables and I have been able to rewrite the variables in the Mat file after making changes by using the following command.
save( datafullfile, 'payoff52', '-append');
However, I can't do that for some variables any longer since yesterday. So I have to save them with a new name to the Mat file. For example, the payoff52 and the IUpayoff both have versions there.
datafullfile is the full path+fileName.
save( datafullfile, 'payoff52', '-append');
Error using save
Can not write file G:\Pm\**\***Data.mat.
Any suggestions? I don't want to keep adding versions of a variable. Thanks!
Name Size Bytes Class Attributes
B10YrSpd - 14346 fints
B10YrSpd_M 1x1 28166 struct
B10YrSpd_MA 1x1 19628664 struct
CopModel 1x1 57614964 struct
IU_Sim 1x1 191082104 struct
IU_Sim_Scn 1x1 378620624 struct
IUpayoff 1x1 13072 struct
IUpayoff01 1x1 13072 struct
commonDates 193x1 1544 double
payoff52 1x1 534464 struct
payoff52_01 1x1 534464 struct
payoff52_02 1x1 599872 struct
sp_HParam 1x1 15094 struct
sp_HParamSim 1x1 62402104 struct
sp_HParam_PriceMonthly - 17268 fints
sPrice_Monthly - 19192 fints
spGH_Sim 1x1 19628664 struct
spGHparam 1x1 52942 struct
spGHparam_FP 1x1 45106 struct
tyM - 51456 fints
tyMNS_NA_Param 1x1 232726 struct
tyMNS_NA_NA_Sim 1x1 38401280 struct

Best Answer

You should not need to save() a file that you used matfile() with: the writable flag tells it to write the changes itself.
When you do save() a file, there is a chance that you will lose the -v7.3 structure that is needed in order to be able to write with matfile. Without -v7.3 in effect in the .mat, you can at best use matfile() in read-only mode.