delete NaN rows and columns but
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
per isakson
2012-5-21
Is this close?
M( all( isnan( M ), 2 ), : ) = []; % removes all rows with all nans
M( :, all( isnan( M ), 1 ) ) = []; % and columns
2 个评论
Claudia
2012-7-1
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!
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Import, Export, and Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!