finding the max ?

조회 수: 1 (최근 30일)
diadalina
diadalina 2018년 12월 4일
편집: diadalina 2018년 12월 4일
i have a vector x=[-1,5,3,4,5]
i want to calculate the max of the vector x and its position using the loop for, i want also to extract the two position here we have max =5, the first position is i1=2 and the second i2=5, how can i do this, can anyone help me ?

채택된 답변

Guillaume
Guillaume 2018년 12월 4일
maxvalue = max(x);
positions = find(x == maxvalue);
No loop needed
  댓글 수: 1
diadalina
diadalina 2018년 12월 4일
thank you mr,Guillaume, i founde it,

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by