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일

1 개 추천

a=[ 1 3 5 6 34 4 0 1 3 4 50]
index=find(a==0)

댓글 수: 4

IBM watson
IBM watson 2018년 11월 9일
Thanks!!
madhan ravi
madhan ravi 2018년 11월 9일
Anytime :)
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개)

카테고리

도움말 센터File Exchange에서 Simulink에 대해 자세히 알아보기

태그

질문:

2018년 11월 9일

댓글:

2018년 11월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by