MATLAB: Find consecutive number of specific length in a vector

find

Hi,
I have a long vector of numbers and I want to find those numbers that are n times consecutively in my vector.
Suppose I choose n=5;
n=5;
x=[10 10 10 10 11 11 11 11 11 12 12 13 13 13 13 13]
I would like an output vector
y=[11 13]
I would like to avoid to use for-loop to count if a number is present n times.
Thank you in advance

Best Answer

>> n = 5;
>> x = [10,10,10,10,11,11,11,11,11,12,12,13,13,13,13,13];
>> f = find([true,diff(x)~=0,true]);
>> d = diff(f)==n;
>> y = x(f(d))
y =
11 13