Searching on a vector of vector

조회 수: 1 (최근 30일)
nedo nodo
nedo nodo 2012년 11월 14일
Hi,
I have a question about searching on a vector of vector. Each element of the first vector is a vector of value. The elements of the outer vector can be duplicated. I have to find a new representation in which there are no duplicates. How can I do it in efficient way?
Example
X=[0,1,0;0,1,1;0,1,0] -> Xnew=[0,1,0;0,1,1] where the first element has value two and the second one.
Thank
  댓글 수: 1
Jan
Jan 2012년 11월 14일
편집: Jan 2012년 11월 14일
A "vector of vectors" is called "matrix.
To find an "efficient" method, we need to know the typical size of the problem. It matters if you want to do this millions of times for a [12 x 3] matrix, or 12 times for a [1e6 x 3] matrix.

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

답변 (1개)

Andrei Bobrov
Andrei Bobrov 2012년 11월 14일
Xnew = unique(X,'rows');

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by