I have some random 2D data fuffa
that I save to a file fuffalo
:
fuffa=rand(10,10);
save('fuffalo','fuffa', '-v7.3')
I then go through a loop that generates other fuffa
data that I want to append (in the third dimension) to the saved variable. To do this, I tried to apply this suggestion:
m1 = matfile('fuffalo.mat', 'Writable', true);
for ii=1:3
fuffa2=rand(10,10);
m1.fuffa(1:10,1:10,end+1)=fuffa2;
end
However, at ii=2
I get the following error:
Variable 'fuffa' has 2 dimensions in the file, this does not match the 3 dimensions in the indexing subscripts.
How can I convince MATLAB to append in the third dimension?