Delete rows that contains []
Mostra commenti meno recenti
Hi
I would like to delete rows that contains [ ].
Thanks very much.
[ ] 1 NaN
[ ] 1 NaN
[ ] 1 NaN
[ ] 1 NaN
[ ] 1 0
'o_c' 1 1
'w_c' 1 1
Risposta accettata
Più risposte (1)
Guillaume
il 25 Nov 2015
c = {[] 1 NaN
[] 1 NaN
[] 1 NaN
[] 1 NaN
[] 1 0
'o_c' 1 1
'w_c' 1 1};
You get the cells of the cell array that are empty by using isempty on each cell. You can use cellfun to check each cell. You can then use any on each row (2nd dimension) of the cell array to delete rows that have any cell empty:
c(any(cellfun(@isempty, c), 2), :) = []
1 Commento
Alfonso Lopez
il 25 Nov 2015
Categorie
Scopri di più su Data Types in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!