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
Solution Comments
Show comments
Loading...
Problem Recent Solvers37
Suggested Problems
-
Maximum running product for a string of numbers
2253 Solvers
-
Return elements unique to either input
808 Solvers
-
299 Solvers
-
find the maximum element of the matrix
536 Solvers
-
Sum the squares of numbers from 1 to n
258 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!
In the definition of the problem, there are lots of 8. You should revise it.
Thanks for your advice, it has been changed.