MATLAB: Make two matrices of same length reducing the size of largest matrix

matrix

Hello, I have two matrix, A = [318×1] and B = [313×1]. In order to compare between two, I need to make size of A same as that of B, by reducing the size of A. Any help?

Best Answer

You could try something like
% Find out the length of the shorter matrix
minLength = min(length(A), length(B));
% Removes any extra elements from the longer matrix
A = A(1:minLength);
B = B(1:minLength);