Removing entire column if any of the value in that column contains a NaN
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Voss
am 4 Apr. 2022
% 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu NaNs 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!