MATLAB: Filling in multidimensional array efficiently

arrayfor loopMATLAB

I need to fill in array of the size (900,1800,80,60) –> (tr,t,f,ch) through a for loop. In every iteration, I will get a bunch of data for a particular f and ch. This bunch, call it b, is the size of 50 by1800 and sometimes it is 49 by 1800.
Example:
array(?,:,f_1,ch_1) = b
I wish in each loop to fill in bunch b in my array. Is there an easy way to determine "?" in each loop? Alternatively, is there an easier way to fill in "array"?

Best Answer

If you want b to be inserted in the topmost rows of each array(:,:,f, ch), then it would be,
array(1:size(b,1),:,f, ch) = b