How to find index range of range of values in an array
조회 수: 49 (최근 30일)
이전 댓글 표시
I have an array of one row and 163495 columns. The values in this array range from 0-160. I am trying to find the indices that the values are from 69-72. When I use the find x==69, it computes out an empty array.
답변 (1개)
Are Mjaavatten
2021년 4월 5일
i = find(x>=69 & x<=72);;
댓글 수: 2
Are Mjaavatten
2021년 4월 6일
My suggestion should work for both integers and non-integers. As a demonstration, try:
y = 60:0.3:80;
i = find(y>=69 & y<=72)
y(i)
Your result seems to indicate that x contains no values in the specified range.
Are you sure x contains what you think? Try, e.g.;
x(1:100)
to see if the values look right.
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!