Find an vector in a cell array
1 次查看(过去 30 天)
显示 更早的评论
I have a cell array of up to hundreds of elements say A = cell(1,100). Each cell has a variety of three-column vectors (all 3-columns but could vary in number of rows): A{1} = [1 2 3; 4 5 6; 7 8 9]; etc.
Is there a way to use the built-in functions to see if the vector [1 2 3] exist in A?
0 个评论
采纳的回答
Fangjun Jiang
2017-6-15
A{1}= [1 2 3; 4 5 6; 7 8 9];
A{2}= [11 2 3; 4 5 6];
A{3}= [1 12 3];
IsInA=any(cellfun(@(x) ismember([1 2 3], x,'rows'),A))
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!