How to find index of the following problem?
1 回表示 (過去 30 日間)
古いコメントを表示
A={[];13;[1,5];10;7;[];8;3;5;18;[];[1,4];[2,33];[3,17];[4,37];[5,1];[6,28];[7,20];[8,15]};
B={[1 10 5]};
Output=[3;4;9]
the elements of index 3 , 4 and 9 in A are contained by B and therefore the output is [3;4;9].
What is the easiest way of getting this output?
0 件のコメント
採用された回答
Walter Roberson
2019 年 10 月 29 日
find( cellfun(@(v) all(ismember(v, B)), A))
2 件のコメント
Walter Roberson
2019 年 10 月 29 日
find( cellfun(@(v) ~isempty(v) && all(ismember(v, B)), A))
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Data Type Identification についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!