Removing entire column if any of the value in that column contains a NaN
3 ビュー (過去 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 で Numeric Types についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!