intersect between a double and a (complicated) cell array

I have a double array A
and I have a cell array B
I want to extract the values in array A, that also are contained in the sixth column of array B.
Ηow this can be achieved?

3 个评论

The 6th column contains cell entries, but you did not tell us anything about the structure of those cell entries.
What output structure do you need? Do you want to know the elements of A that appear anywhere in any entry in column 6? Do you want to know, for each row of B, which elements of A that appear anywhere in any entry in that row of column 6? Do you need a breakdown of locations per entry in A ?
Yes you are right, the cell entries in the sixth column contain numbers (like the numbers in array A).
Yes, I just want to know the elements of A that appear anywhere in any entry in column 6.

请先登录,再进行评论。

 采纳的回答

col6_numerics = cell2mat(vertcat(YourCell{:,6}));
A_that_appear = A(ismember(A, col6_numerics));

2 个评论

Hello! And if I want to know, the row of B, which elements of A appear in any cell entry in that row of column 6?

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Matrices and Arrays 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by