How to get row index of cell which contains certain matrix

2 ビュー (過去 30 日間)
Hany Ferdinando
Hany Ferdinando 2015 年 1 月 19 日
コメント済み: Hany Ferdinando 2015 年 1 月 19 日
Hi all,
I put my measurement in N by 2 cell, called Data. The first column of this cell contains logical value with the same size, say 1x12. I have another matrix called A (1x12 logical). I want to get which row in Data which contains A.
Thanks a lot
regards Hany

採用された回答

Guillaume
Guillaume 2015 年 1 月 19 日
Normally, you'd use ismember for this, but ismember is not defined for cell arrays (except cell arrays of strings), so use cellfun instead:
rows = find(cellfun(@(m) isequal(m, A), Data(:, 1)));

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by