Filter löschen
Filter löschen

Unique Rows in Cell Array

2 Ansichten (letzte 30 Tage)
RDG
RDG am 2 Apr. 2013
Suppose my problem requires me to use a cell array and the content is as such: (Please forgive my bad coding method. I just want to illustrate the problem)
a=cell(2,1)
a{1}=[1 1 1 1;1 1 1 1;2 3 2 3;2 3 2 3;2 4 2 1;]
a{2}=[4 5 6 7;4 5 6 7;2 3 4 5;2 3 4 5;1 2 3 4;]
How can I find the occurrence of duplicate values for each row in each cell array? (Since conventional unique function cannot be applied on cell array contents)

Akzeptierte Antwort

José-Luis
José-Luis am 2 Apr. 2013
my_unik = cellfun(@(x) unique(x,'rows'),a,'uniformoutput',false);
Or what is it you want?
  1 Kommentar
RDG
RDG am 2 Apr. 2013
Thank you. I can work around the code. I tried cellfun earlier but I didn't really understand how to play around with it. Thanks for the tip!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices 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