How to declare 100 random vectors of type uint8. The length of each vector should be 100. Randomly select one Vector with all other 99 Vectors.Store the distances into new vector D.Sort the vector D in ascending order.Print the top 10 distance with their indexes.
You can call the coding directly in MATLAB by Downloading the following files and calling in MATLAB:
Download
Download
CODE:
b = uint8(rand(100,100) * 100);
a = b(1:end,1);
[y x] = size(b);
dis = zeros(1,x);
for i=1:x
c = b(:, i);
d = (a - c).^2;
dist(i) = sqrt(sum(d));
E=dist(:,:);
end
sort(E);
E(1:10)
I = find(E(1:10))
You can call the coding directly in MATLAB by Downloading the following files and calling in MATLAB:
Download
Download
CODE:
b = uint8(rand(100,100) * 100);
a = b(1:end,1);
[y x] = size(b);
dis = zeros(1,x);
for i=1:x
c = b(:, i);
d = (a - c).^2;
dist(i) = sqrt(sum(d));
E=dist(:,:);
end
sort(E);
E(1:10)
I = find(E(1:10))
No comments:
Post a Comment