Filter löschen
Filter löschen

how to find index of cell array?

7 Ansichten (letzte 30 Tage)
Leonardo Wayne
Leonardo Wayne am 19 Apr. 2016
Kommentiert: Stephen23 am 19 Apr. 2016
I want to the find row number of where the elements of cell array "motors_cell" match cell array "get_motors_no_workbook2" . The row number refers to where the match occurred in the cell "get_motors_no_workbook2". This should be done for any size of "motors_cell" and for different values as well.
Note: size of "get_motors_no_workbook2" can have multiple rows but one column.
  1 Kommentar
Stephen23
Stephen23 am 19 Apr. 2016
@Mohammad Abdalnasir Khalid Al-Hiyali: you asked a very similar question, which I answered:
Have you given up on that approach? If my answer answered your question then please consider accepting it.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Adam
Adam am 19 Apr. 2016
doc ismember
should work for this I think. e.g.
a = { 'a', 'b', 'c' };
b = { 'b', 'd', 'a', 'a', 'h', 'b' };
[~, idx] = ismember( b, a );
will give, for each element in b the index of the same element in a, if one exists. From that you should be able to get what you want.

Weitere Antworten (0)

Kategorien

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