How to clean up the repeating element in an array?

1 次查看(过去 30 天)
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?

采纳的回答

Walter Roberson
Walter Roberson 2022-6-27
x = [0 0 0 0 2 2 4]
x = 1×7
0 0 0 0 2 2 4
v = unique(x)
v = 1×3
0 2 4
  3 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Operators and Elementary Operations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by