MATLAB: Find observations with nonconsecutive numbers

find

A=[55; 56; 57; 58; 26; 27; 28]
I want to find the observations in A where the two consecutive observations are not equal. In this case it should be the 5th observation since 26~=58. How can I do that elegantly?

Best Answer

find(diff(A) ~= 1) + 1