Filter löschen
Filter löschen

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

4 Ansichten (letzte 30 Tage)
Iain
Iain am 7 Jun. 2013
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 Kommentar
Iain
Iain am 7 Jun. 2013
Bearbeitet: Iain am 7 Jun. 2013
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';

Melden Sie sich an, um zu kommentieren.

Antworten (1)

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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by