How can I delete a row from a cell aray, with empty cell as first column
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Dimitris Kokkinos
am 25 Mär. 2014
Kommentiert: Arnab Roy
am 1 Dez. 2020
I have a cell aray with 2 columns.
A={[7;8],6;[],19;[3;4;5;6],11;[],25;[4;5],58;[],63}
I want to delete all rows which contain empty cells.How can I do that?
0 Kommentare
Akzeptierte Antwort
Ken Atwell
am 25 Mär. 2014
Bearbeitet: Ken Atwell
am 25 Mär. 2014
I think this is what you are after: The line of code below will call isempty on each row in the first column, and then trim A to only those rows that are not empty.
>> A(~cellfun(@isempty, A(:,1)), :)
ans =
[2x1 double] [ 6]
[4x1 double] [11]
[2x1 double] [58]
2 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!