find cells based on vector

1 回表示 (過去 30 日間)
skysky2000
skysky2000 2017 年 7 月 12 日
コメント済み: skysky2000 2017 年 7 月 12 日
Dear all, I've problem with the cell,
a= {[67 8 33] [1 2 3 5] [2 88 5] [3 66 7 90] [3] [66 78 12 1 44 6 77 3] [ 91 92 100]}, how to find each cell based on vector d=[ 3 1 77 100]. answer expect it is:
b= {[1 2 3 5] [3 66 7 90] [3] [66 78 12 1 44 6 77 3] [66 78 12 1 44 6 77 3] [ 91 92 100]} Thanks a lot,you always help me.
  1 件のコメント
Jan
Jan 2017 年 7 月 12 日
編集済み: Jan 2017 年 7 月 12 日
You forgot to explain the procedure. The readers have to guess the relation between a, d and b, but this is not obvious.
What have you tried so far? You have asked many questions concerning cells now and did not show your own effort.

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

採用された回答

Guillaume
Guillaume 2017 年 7 月 12 日
At a guess (see Jan's comment):
a = {[67 8 33] [1 2 3 5] [2 88 5] [3 66 7 90] [3] [66 78 12 1 44 6 77 3] [ 91 92 100]}
d = [3 1 77 100];
b = a(cellfun(@(cellcontent) any(ismember(d, cellcontent)), a))
  1 件のコメント
skysky2000
skysky2000 2017 年 7 月 12 日
Thanks a lot Guillaume, its work fine.

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by