Further to a question that was asked a few days ago (which Matt Fig answered to the satisfaction of the author – see link below):
http://www.mathworks.com/matlabcentral/answers/9393-basic-question-how-to-find-range-of-index-values
In particular, I am searching for a sequence of a minimum of 5 ones in order to perform another function on these elements. That is to say that I would like to perform the second function on any sequence where 5 or more ones may occur. Currently my code looks like:
S3 = findstr(B, ones(1, 5));
But when performing the second action, should the sequence happen to be greater than 5, I find that only the first 5 values identified with the code above are addressed. For example, I have a run of 10 ones, where only the first five values are are found and subsequently computed. Instead, I would like to compute values for all 10 elements appearing in the sequence.
Any ideas on how I might be able to get around this?
The data is a single row vector (1 X 14620); A range of integers where min value = 1 and max value = 6578
e.g
B = [17 4 1 3 2 3 2 1 1 1 1 1 1 1 1 1 1 2 ………12 1 15 372 3 1 1 1 2 42 93 1 105 5 1 1 1 1 78 1 2]
Best Answer