I have a loop that each time has new data in an array. I would like to save that array in a .mat file after each insertion of the loop and I want the name of the file to change with the loop value. Say I go through my loop 5 times, I want to have 5 files array_1.mat array_2.mat array_3.mat array_4.mat array_5.mat
To test my idea I wrote:
for A=1:10;
filename = sprintf('array_%d.mat', A)
save('-mat', filename, 'A');
endfor
after running this code in octave, I do get 5 files with the correct names but they don't seem to be .mat file, I can't load them again into octave. I have tried a lot of other small syntax changes and nothing seems to work. Can anyone tell me what i am doing wrong and/or give my a test example that changes the name of a.mat file with the loop variable. Thanks