Where is the zero?

조회 수: 3 (최근 30일)
IBM watson
IBM watson 2018년 11월 9일
댓글: IBM watson 2018년 11월 9일
How to find the location of a zero (or a different number) in a vector ?
like :
a=[ 1 3 5 6 34 4 0 1 3 4 50]
=>7

채택된 답변

madhan ravi
madhan ravi 2018년 11월 9일
편집: madhan ravi 2018년 11월 9일
a=[ 1 3 5 6 34 4 0 1 3 4 50]
index=find(a==0)
  댓글 수: 4
Stephen23
Stephen23 2018년 11월 9일
Note that often logical indexing is more efficient than using find.
IBM watson
IBM watson 2018년 11월 9일
I will take a look. Thanks :)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by