フィルターのクリア

intersection of two tables question

1 回表示 (過去 30 日間)
Léon
Léon 2012 年 9 月 27 日
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),:)
Léon
Léon 2012 年 9 月 27 日
Thank you very much indeed!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by