I wonder if you have used the correct signature for save method.
The correct signature for your job is:
save (filename, version, variables).
as opposed to save(filename, variables, version)
. But because -v is parsed properly, it is okay.
You can check if it is a valid variable name by using isvarname(string)
This should do it:
save(sprintf('data%d.mat',h), ['A' h], ['B' h], ['C' h] ,'-v7.3')
It would be better if you AVOIDED the -v7.3 as you are probably hardcoding the version-related settings for the MAT files. Try and use without the -v argument.
BUT your matrices are A, B, and C as opposed to A1, B1, C1,....etc. You can supply whatever variable name you like in save method, AS LONG AS THEY EXIST in your current workspace.
All you needed is a string concatenation which, in MATLAB, is similar to declaring a matrix e.g. a = ['my' 'name' 'is' 'Bolshoi']
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…