Select an element of variable. HELP.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
i have centroids
A = [78 124;209 125];
B = [80 127;212 134];
i want to select the element in B which is closest to an element in A. for example B1 is the element of B that closest to A(1,:) and B2 is the element of B that closest to A(2,:)
thx sorry for my poor question, im new to matlab.
0 Kommentare
Antworten (1)
Rick Rosson
am 18 Apr. 2012
N = numel(B);
x = zeros(N,1);
for k = 1:N
x(k) = min(abs(A(:) - B(k)));
end
0 Kommentare
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!