How can I count the followed occurrences of each element in a vector in MATLAB?
Show older comments
Hi, I want to count the number of followed occurrences of each element in a vector.
So if my input is
x = [1 1 1 2 2 1 1 2 5 5]
I need an output
y = [1 2 1 2 5;3 2 2 1 2] How do I do this?
2 Comments
William
on 30 Nov 2015
check out this post : http://www.mathworks.com/matlabcentral/answers/34302-how-to-find-consecutive-numbers
lamghari
on 30 Nov 2015
Accepted Answer
More Answers (1)
Categories
Find more on Random Number Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!