removing repeated values from an array

Suppose I have an array [1.2 8 89 1.2 4 8 32 1.2]. Is there any MATLAB function that gives me the array without repeated values: [1.2 8 89 4 32]?!

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 9 月 14 日
編集済み: Azzi Abdelmalek 2013 年 9 月 14 日

0 投票

Y=[1.2 8 89 1.2 4 8 32 1.2]
unique(Y) % The result is sorted
%or
unique(Y,'stable') % the result is not sorted

1 件のコメント

Ibehma01
Ibehma01 2013 年 9 月 14 日
awesome. thank u so much

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2013 年 9 月 14 日

0 投票

Try this:
m = [1.2 8 89 1.2 4 8 32 1.2]
mu = unique(m, 'stable')

カテゴリ

ヘルプ センター および File ExchangeShifting and Sorting Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by