intersection of two tables question

1 次查看(过去 30 天)
Hello,
I have 2 cell arrays of the following form:
A = {1,2,3;'a','b','c';'e','f','g'};
B = {'x','y';[],[];'z','v'};
and I want to create a third cell array with the content of A, but with only those rows that are not empty in B. What is the most efficient way to do that?
The result should be:
C = {1,2,3;'e','f','g'};
Help is greatly appreciated

采纳的回答

Matt Fig
Matt Fig 2012-9-27
A(all(~cellfun('isempty',B),2),:)
  3 个评论
Matt Fig
Matt Fig 2012-9-27
Yes, just take off the ~.
A(all(cellfun('isempty',B),2),:)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile 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