delete NaN rows and columns but
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I want to remove the NaN column and row in my image so the size will be decreased, but since I used the "find' command it Matlab, it also remove the NaN that changes the shape of the image,too. I just want to remove the NaN data as much as possible but keep the other NaNs that cannot be removed in order to have the same shape.
0 Kommentare
Akzeptierte Antwort
per isakson
am 21 Mai 2012
Is this close?
M( all( isnan( M ), 2 ), : ) = []; % removes all rows with all nans
M( :, all( isnan( M ), 1 ) ) = []; % and columns
2 Kommentare
Claudia
am 1 Jul. 2012
Was just looking exactly for that! Thank you! And thanks showing both (column and rows)! It looks easy to change from row to column if you know how ... but if you don't ... can drive you crazy!
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!