Let's say we have an arbitrary vector like this with ascending values:
a= [10 11 12 19 21 25 29 30 31 32 33 39 50];
and we want to find the first and last element of each consecutive (integer) values. The answer could be in this form:
First consecutive values: [10 11 12]
Second consecutive values: [29 30 31 32 33]
CI_f = [10 29]
CI_l = [12 33]
How could we do it in MATLAB without loop?
Is it also possible to put a condition for the length of the consecutive values to be between specific numbers of values, let's say between 3 and 8?
Thanks in advance for helping :)