필터 지우기
필터 지우기

a problem with unique command

조회 수: 1 (최근 30일)
Mnr
Mnr 2016년 4월 4일
편집: Walter Roberson 2016년 4월 5일
Hello all,
I have an mx1 vector A, that is ordered in an ascending manner. I would like to find unique elements of this vector, however, by using "unique" command, I am getting the same output as A. Can anybody tell me how I can resolve this issue? I think it has to be done with matlab precision, but I do not know how to fix it.
Thanks!
  댓글 수: 2
James Tursa
James Tursa 2016년 4월 4일
Please post a short example showing A and what you want for output, and how you are currently using unique.
Mnr
Mnr 2016년 4월 4일
편집: Walter Roberson 2016년 4월 5일
when I use "format long"
A=[1.414213562645795
1.414213562645985
1.414213562645985
1.414213562646871
1.414213562646871
1.553773974242559
1.553773974242559
1.553773974242644]
and I use unique(A), that's why I get the same output as A, while I need matlab to consider A as
[1.414
1.414
1.414
1.414
1.414
1.553
1.553
1.553]
so that the output to unique(A) be [1.414 1.553]

댓글을 달려면 로그인하십시오.

채택된 답변

Steven Lord
Steven Lord 2016년 4월 4일
Use uniquetol with an appropriate tolerance or discretize your data.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by