Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
finding min nummber in a vector
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
hi :}
I got to write a program in one code line.
Finding minimum num in a vector without using min or max functions.
1 Kommentar
Antworten (2)
KSSV
am 28 Jul. 2017
You arrange your vector in ascending order using sort and pick the first number.
V = rand(10,1) ;
V = sort(V,'ascend') ;
iwant = V(1)
5 Kommentare
Image Analyst
am 29 Jul. 2017
OK, then I guess we can put both "statements" on one line of code:
V = sort(V,'ascend'); iwant = V(1)
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!