If you know that the period remains constant for the entire array, you could use the diff() function and pull out the location of the first value like this:
>> diff_out = find(diff(v));
>> diff_out(1)
ans =
3
Alternatively, if the period varies, you could run an additional diff to get a vector that represents number of elements between changes like so:
>> diff([0,find(diff(v))])
ans =
3 3