Problem 2651. Find the same and successive values in a vector
Find the same and successive values in a vector. For example:
Input x = [ 1 0 0 1 1 1 1 0 1 1 1 0 0 0 1 ]
Start and end equal to [ 2 4 9 12
3 7 11 14 ]
The corresponding values are [ 0 1 1 0 ]
So given the input x above, you should construct the output y as follows
y = [ 2 4 9 12
3 7 11 14
0 1 1 0 ]
Solution Stats
Problem Comments
-
1 Comment
goc3
on 3 Mar 2018
Additional test cases have been added.
Solution Comments
Show commentsGroup

Indexing IV
- 15 Problems
- 28 Finishers
- Hard limit function
- How to reverse spdiags?
- Combine Data With Gaps
- Sum My Indices
- Longest Sequence of NaNs
- Find the same and successive values in a vector
- Pancake sorting - minimum flips.
- Elements with highest local average
- Neither minima nor maxima
- How to reverse spdiags?
- Find indices of diagonal elements
- Find Elements in Range
- Find the same and successive values in a vector
- Find the distance between runs
- Split array into pieces according to corresponding array
- How close to a hole
- Pancake sorting
- Pancake sorting - minimum flips.
- Combine Data With Gaps
- Sum My Indices
- Longest Sequence of NaNs
Problem Recent Solvers51
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!