필터 지우기
필터 지우기

compare a group of data

조회 수: 1 (최근 30일)
zhiping
zhiping 2011년 6월 9일
I want to compare a group of data, try to delete the same element, and then output the data unique. For example, I have many groups of data, like u(:,1),u(:,2),u(:,3)... I only compare the first number of every group, if the numbers are equal, I output the whole group of numbers. First of all, I want to use 'unique', but it seems not what I want,any idea? thanks in advance u(:,1)=[1 2 3 6 8],u(:,2)=[8 9 6 5 3 ],u(:,3)=[1 2 3 6 8], u(:,4)=[ 4 5 6 9 8], u(:,5)=[7 6 4 7 3]... Through comparing the first number of every group, I delete u(:,1) or u(:,3) and then output the other three group.
  댓글 수: 1
Sean de Wolski
Sean de Wolski 2011년 6월 9일
Please provide a small example of inputs/operation/output

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

채택된 답변

Sean de Wolski
Sean de Wolski 2011년 6월 9일
unique(u.','rows').';
transpose and use the rows option, then retranspose
If you don't want it sorted:
[~,idx] = unique(u','rows');
u(:,idx)
  댓글 수: 1
zhiping
zhiping 2011년 6월 9일
thanks a lot!

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by