Hi all,
This is my ham-fisted attempt to assign memory for the above. Let's say that I want my simulated data to be normally distributed random numbers (they're not, but right now I just care about having a structure in place) arranged in 3 series of 226 observations. So I create a cell that contains the 226x3 (empty, for now) arrays. Let's say I want 4 simulations, so 4 four of those (that's rubbish,but, again, just to keep things simple).
Then I create a 3 dimensional array of the right dimensions with said normal, random data. At this point I ought to extract each 226x3 lots of normal random data and shove it in the cell. Presumably, at that point, I can just put my model in that second loop and do what I need to do.
I can't seem to be able to do the extracting bit. M only contains the last 226x3 block from the 3 dimensional array (rather than all 4).
clc;
clear;
par.muorig = 5;
par.sigmaorig = 5;
Nsim = 4;
Lseries= 226;
M=cell(4,1);
for imatrices=1:Nsim
M{imatrices}=zeros(Lseries,3);
end
for isim= 1:Nsim
data(:,:,isim)=normrnd(par.muorig,par.sigmaorig,Lseries,3);
ff=1
for rr=1:Nsim
M=data(:,:,isim);
ff=ff+1
end
end
Any suggestions on how to do this? I look forward to hearing from you!