Find row with unequal distance

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!

Answers (1)

idx = find(diff(diff(A)) > 0,1,'first');
A(idx+2)

2 Comments

Thank you for your answer!
Unfortunatly not successful for now:
Torsten
Torsten on 10 May 2022
Edited: Torsten on 10 May 2022
If you want the row, take idx+2 as result instead of A(idx+2).

Sign in to comment.

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Release

R2021a

Tags

Asked:

on 10 May 2022

Edited:

on 10 May 2022

Community Treasure Hunt

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

Start Hunting!