Hi All,
I have an array, 'data' (5x16x2), that I have shifted to the left (by 1 column) and zero-padded the right accordingly. However, when I run my variable through a nested for loop, my 3d array gets transformed to 2d (5×32). I'm facing some trouble trying to figure out how to maintain my array size as I run it through the nested for loop. I essentially want my 'dataShift' varible to be the same size as my 'data' variable (5x16x2).
My code looks like this:
%dummy data
for ii = 1:2 for i=1:16 data(:,i,ii)=i(:,:); endend%constant variables
sink = 8;layerIV = 7;shift = abs(layerIV - sink);%shift data
for ii = 1:2 for ch = 1:16 if sink > layerIV dataShift = [data(:, shift+1:end), zeros(size(data,1),shift)]; end end end
I thought that perhaps the following might work:
dataShift(:,ch,ii) = [data(:, shift+1:end), zeros(size(data,1),shift)];
But I get the following error: "Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 1-by-32."
Would really appreciate any help.
Best Answer