MATLAB: How to compare two large matrices

matricesmatrixmatrix arraymatrix manipulation

Hi I'm new to matlab and was wondering how to compare two matrices
Basically I have one matrix that is 950×49 and one that is 950×1 I want to compare the two matrices to bring back the 10 closest values of each column of x that is compared with y, into a new matric 'new'. If anyone could please help, it would greatly be appreciated!

Best Answer

N = size(x,2);
u = ones(1,N);
d = abs(x - y*u);
v = sort(d);
z = v(1:10,:);
Related Question