Azzera filtri
Azzera filtri

intersection of two tables question

1 visualizzazione (ultimi 30 giorni)
Léon
Léon il 27 Set 2012
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

Risposta accettata

Matt Fig
Matt Fig il 27 Set 2012
A(all(~cellfun('isempty',B),2),:)
  3 Commenti
Matt Fig
Matt Fig il 27 Set 2012
Yes, just take off the ~.
A(all(cellfun('isempty',B),2),:)
Léon
Léon il 27 Set 2012
Thank you very much indeed!

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by