MATLAB: How to find the index location of repeated consecutive numbers over a tolerance within a vector

find index of first integer for repeated consecutive values within a vectorfind index reference for repeated elements over a tolerance within a vectorfind repeated consecutive integers within a vectorfinding repeated values within a vectorindex locatio

For vector A, how would you find the index value for the start of a repeated consecutive value repeated more than x times
Example 1:
A = [4 2 7 4 4 7 9 9 3 8 8 8 8 8 8 5 6 6 7 ]
if x is 5 in this case I would like the answer to give 10.
Example 2:
For vector A attached using x = 7, would like the answer outputed to be 4249
Any sugesstions are much appreciated

Best Answer

This should work better. Did not previously think about multi-digit numbers.
n=7;%minimum number of repeats
a=num2str(~(diff(A)==0));
a=a(a~=' ');
idx=strfind(a,repmat('0',1,n-1));