delete NaN rows and columns but
조회 수: 7 (최근 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!