Choose some data that has a minimum value
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
hello all,,
i wanna asking about how to choose some data that has a minimum value,,
example :
i do input five data
then after that it will choose three data that has minimum value
i've knew that if choose minimum data in matlab use "min" command
but it just give one value
i want in my case, it can choose three data that has minimum value
can someone help me??
this is my code
a= input ('Input Number of Data :');
for c=1:a
int2 = ['Input The First Score - ',num2str(c),' :'];
int3 = ['Input The Second Score - ',num2str(c),' :'];
b(c,1) = input(int2);
b(c,2) = input(int3);
end;
for d = 1 : 1
int4= ['Input The First Data :'];
int5 = ['Input The Second Data :'];
e(d,1) = input(int4);
e(d,2) = input(int5);
end;
x = ( b(:,1) - e(1,1)).^2 + (b(:,2) - e(1,2)).^2;
disp(x)
NB : Sorry for my bad english :)
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 20 Jan. 2013
Bearbeitet: Azzi Abdelmalek
am 20 Jan. 2013
x=[4 1 3 8 2 0 10]
a=sort(x); % sort x in ascending order
min_value=a(1:3) % choose the 3 first lowest numbers
3 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Variables 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!