Hi, I'm trying to extract a series of 32×32 matrices of a large original 6601×32 matrix, and save them into a 3D (32x32x200) one. Each matrix is a sample I've logged from a scanning device (200 in total). I'm having this error but I couldn't find out why it happens or how to fix it.
% Index exceeds matrix dimensions.
This is the part of my program that throws the error:
A = cell2mat(raw);[m,n] = size(A);% Create 200 Frames 32x32
framesize = 32 % Number of Rows and Columns of Each Frame
Frame3d = zeros(32,32,200); % Prealocate Frames
% % Now scan A, getting each frame and putting it as a slice of a 3D array.
framenumber=1;for row = 1 : 33 : m row1 = row + 1; % framesizer = 32, and row1 = row +1 to avoid first row
row2 = row1 + framesize - 1; Frame3d(:,:,framenumber) = A(row1:row2,:); % Assign the submatrix to the slice --> Here throws the error
framenumber = framenumber + 1; end
Basically I cannot figure it out.
Kind regards.
Best Answer