필터 지우기
필터 지우기

How to quickly extract a unique list of rows from a cell array?

조회 수: 4 (최근 30일)
Iain
Iain 2013년 6월 7일
So, I have an unacceptably large cell array, with far too many rows to reasonably display, and only 5 columns.
Each column contains a different format (some string, some numeric).
I know that many of the rows of the array are duplicated, so what I would like to do is to quickly and simply remove these duplicates.
Has anyone got a quick way of achieving this?
  댓글 수: 1
Iain
Iain 2013년 6월 7일
편집: Iain 2013년 6월 7일
Array = {45 654 9841 'ra' 'rb';
45 684 9841 'ra' 'rb';
...
45 654 9841 'ra' 'rb';
45 684 9842 'ra' 'rb';
1 651 91 'ra' 'ra';

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

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 6월 7일
[idx,idx]=unique(cell2mat([cellfun(@num2str,A(:,1:3),'un',0) A(:,4:5)]),'rows')
out=A(idx,:)
  댓글 수: 1
Iain
Iain 2013년 6월 7일
Doesn't work due to the fact my numbers vary in magnitude by more than 10 times.

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

카테고리

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