필터 지우기
필터 지우기

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