필터 지우기
필터 지우기

Find row with unequal distance

조회 수: 1 (최근 30일)
Christopher Schoß
Christopher Schoß 2022년 5월 10일
편집: Torsten 2022년 5월 10일
Hey,
i have a array(vector) like this:
A=[2,4,7,9,12,14]
Between 4 and 7, and also between 9 and 12 are bigger distances (=3) as between the other entries (distance=2).
I want to determine the row number of the first entry with bigger distance to the previous entry.
So in my example its entry 7 and therefor it should output me 3 (the row number of 7).
Any idea how to determine this?
Thank you!

답변 (1개)

Torsten
Torsten 2022년 5월 10일
idx = find(diff(diff(A)) > 0,1,'first');
A(idx+2)
  댓글 수: 2
Christopher Schoß
Christopher Schoß 2022년 5월 10일
Thank you for your answer!
Unfortunatly not successful for now:
Torsten
Torsten 2022년 5월 10일
편집: Torsten 2022년 5월 10일
If you want the row, take idx+2 as result instead of A(idx+2).

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

카테고리

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

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by