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개)

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 Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by