フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

finding min nummber in a vector

1 回表示 (過去 30 日間)
yuval ohayon
yuval ohayon 2017 年 7 月 28 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
hi :}
I got to write a program in one code line.
Finding minimum num in a vector without using min or max functions.

回答 (2 件)

KSSV
KSSV 2017 年 7 月 28 日
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 件のコメント
Walter Roberson
Walter Roberson 2017 年 7 月 29 日
The requirement is one line, not one statement.
Image Analyst
Image Analyst 2017 年 7 月 29 日
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 2017 年 7 月 29 日
Arranging the vector in acending order by the absolut value of the elements,this is another task that i confuse about.

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by