Searching the location of a specific cell in a cell array

2 Ansichten (letzte 30 Tage)
Hello community! I have a cell array (1x1000) like this {[1 2], [3 5], [4,2],..., [2 5]} I found the most commonly occurring cell in this, but now I want to find the positions of this cell. Example what is the position of cell [2 5]? and the answer I want to be the (1, 100) (1,205) (1,276) etc
Please help, if anyone knows.

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 8 Mai 2013
Bearbeitet: Azzi Abdelmalek am 8 Mai 2013
v={[1 2], [3 5], [4,2],[3 5] ,[4 2]}
w=cell2mat(v')
idx=find(ismember(w,[4,2],'rows'))
  3 Kommentare
Azzi Abdelmalek
Azzi Abdelmalek am 9 Mai 2013
v={[1 2], [3 5], [4,2],[3 5],[],[4 2]}
idx=find(cellfun(@(x) isequal(x,[4,2]),v))
nicolas
nicolas am 9 Mai 2013
its working! Thank you so much

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by