How to clean up the repeating element in an array?
1 view (last 30 days)
Show older comments
Sotheara Oum
on 27 Jun 2022
Commented: Sotheara Oum
on 27 Jun 2022
I have a variable x = [0 0 0 0 2 2 4]
I want to create another varible v that stores only the different element inside x which mean v = [0 2 4]
How to do that?
0 Comments
Accepted Answer
Walter Roberson
on 27 Jun 2022
x = [0 0 0 0 2 2 4]
v = unique(x)
More Answers (0)
See Also
Categories
Find more on Operators and Elementary Operations 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!