Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

finding min nummber in a vector

1 visualizzazione (ultimi 30 giorni)
yuval ohayon
yuval ohayon il 28 Lug 2017
Chiuso: MATLAB Answer Bot il 20 Ago 2021
hi :}
I got to write a program in one code line.
Finding minimum num in a vector without using min or max functions.

Risposte (2)

KSSV
KSSV il 28 Lug 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 Commenti
Walter Roberson
Walter Roberson il 29 Lug 2017
The requirement is one line, not one statement.
Image Analyst
Image Analyst il 29 Lug 2017
OK, then I guess we can put both "statements" on one line of code:
V = sort(V,'ascend'); iwant = V(1)

yuval ohayon
yuval ohayon il 29 Lug 2017
Arranging the vector in acending order by the absolut value of the elements,this is another task that i confuse about.

Questa domanda è chiusa.

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by