Problem 44511. Find the repeating elements and repetitions of a row vector.
So let's say that x is a vector, for example, x = [4, 4, 5, 5, 5, 6, 7, 7,8, 8, 8, 8]
Now we want to get the following two vectors, l = [2, 3, 1, 2, 4]; The number of repeats per element of x.
v = [4, 5, 6, 7, 8]; The value of repeating elements in x.
Solution Stats
Problem Comments
-
2 Comments
Mehmet OZC
on 4 Feb 2018
In the definition of the problem, there are lots of 8. You should revise it.
Jiahang Li
on 4 Feb 2018
Thanks for your advice, it has been changed.
Solution Comments
Show commentsProblem Recent Solvers34
Suggested Problems
-
337 Solvers
-
Arrange vector in ascending order
762 Solvers
-
07 - Common functions and indexing 5
401 Solvers
-
908 Solvers
-
Product of all elements in an array
81 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!