如何确定元胞数组中有多少元素包含特定元胞

How to determine how many elements of a cell arrary contain a specific cell

我有一个 4x1 的单元格,

{{1,2,3};{2,3};{1,2,3};{2,3}}

如何找出哪些单元格包含 {2,3}

[0,1,0,1] 对于上面的例子。

提前致谢

如果aa = {{1,2,3};{2,3};{1,2,3};{2,3}}

您可以使用 for 循环并存储结果...

for jj = 1:4
    correct(jj) = isequal(aa{jj}, [2 3])
end

使用 cellfunisequal:

cellfun(@(x)isequal({2,3},x),yourcell)