Finding row index an element in cell array

1 回表示 (過去 30 日間)
Hari
Hari 2017 年 1 月 4 日
コメント済み: Hari 2017 年 1 月 4 日
How to find the row index of an element in a cell array if the cell array is non uniform like this:
c=
1
[6,7]
6
7
7
i.e if one asks for row index of 7, it should give 2,4,5 as answer. I tried using this: index=find([C{:}] == 7) but it gave 3,5,6 counting 6 and 7 in row 2 separately

採用された回答

Guillaume
Guillaume 2017 年 1 月 4 日
find(cellfun(@(subc) ismember(7, subc), c))
  1 件のコメント
Hari
Hari 2017 年 1 月 4 日
It worked. Thank you

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by