Delete rows with NaN records
Ältere Kommentare anzeigen
How can I delete rows which have NaN on one of the column.
Akzeptierte Antwort
Weitere Antworten (3)
Chris Turnes
am 7 Mär. 2017
5 Stimmen
Not that this question needed another answer, but, you can also check out the rmmissing function that was introduced in R2016b. If you combine this with standardizeMissing, you can convert your 'GNAs' strings to a standard missing indicator, and then remove the rows with rmmissing.
carmen
am 12 Mär. 2012
check out the isnan() functioion. the following code looks like a workaround but it works:
A=[1 2 3;nan 4 5;nan 6 nan];
B=A(sum(isnan(A),2)==0);
B %returns the only nan-free row of A: [1 2 3]
hf
1 Kommentar
A=[1 2 3;nan 4 5;nan 6 nan]
B=A(sum(isnan(A),2)==0,:);
B %returns the only nan-free row of A: [1 2 3]
Manuel Aboy
am 28 Dez. 2022
0 Stimmen
mpg = mpg(~ismissing(mpg));
Kategorien
Mehr zu Data Type Identification finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!