Removing entire column if any of the value in that column contains a NaN
조회 수: 1 (최근 30일)
이전 댓글 표시
I am trying to clean up my dataset. Therfore I want to remove any columns that contain any Nan values.
The dataset is of form table. I have tried a few approaches but did not succeed
댓글 수: 0
채택된 답변
Voss
2022년 4월 4일
% make a table with some NaNs:
A = magic(5);
A([7 15]) = NaN;
t = array2table(A)
% remove columns/table-variables with any NaNs:
t(:,any(isnan(t{:,:}),1)) = []
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 NaNs에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!