find cells based on vector
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
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))
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!