remove the frequent values withou sorting

1 回表示 (過去 30 日間)
huda nawaf
huda nawaf 2022 年 7 月 10 日
コメント済み: huda nawaf 2022 年 7 月 11 日
hello
I need a function remove the frequent values(keeping the first appearance of value) without using unique because it is making sortg
For example
x=[3 4 3 5 1 0 4 2];
I need x to be
x=[3 4 5 1 0 2]
Thanks in advance

採用された回答

the cyclist
the cyclist 2022 年 7 月 10 日
You can still use unique:
x = [3 4 3 5 1 0 4 2];
x = unique(x,"stable")
x = 1×6
3 4 5 1 0 2

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by