I would like to create and save a variable that contains the file number given in a string, for example:
file='1'; a=[1 2 3];name = ['a' num2str(file), '=a'];eval(name);
which creates a1=[1 2 3]
How can I now save this variable a1 in a mat file (without need to write a1, because this should work in a for loop, where 1 in incremented) ? Thanks
Best Answer