필터 지우기
필터 지우기

How to remove identical pair of data from a matrix in MATLAB?

조회 수: 1 (최근 30일)
Abhiram B R
Abhiram B R 2021년 5월 11일
댓글: Jonas 2021년 5월 11일
I have a Nx2 matrix with identical pairs. Something like this:
b_data = [ 1 2; 3 4; 7 10; 2 1; 10 7; 11 12];
i consider 1 2, 2 1 as identical
I need to make this
b_data = [1 2; 3 4;7 10; 11 12];
Is there any command for doing so?

채택된 답변

Jonas
Jonas 2021년 5월 11일
use something like
unique(sort([1 2; 2 1; 3 5],2),'rows')
  댓글 수: 4
Rik
Rik 2021년 5월 11일
Ah, sorry, I must have read it too quickly. Have an upvote as an apology.
Jonas
Jonas 2021년 5월 11일
no problem, i also often read faster than i can think ;)

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by