Delete rows with NaN records
Mostrar comentarios más antiguos
How can I delete rows which have NaN on one of the column.
Respuesta aceptada
Más respuestas (3)
Chris Turnes
el 7 de Mzo. de 2017
5 votos
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
el 12 de Mzo. de 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 comentario
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
el 28 de Dic. de 2022
0 votos
mpg = mpg(~ismissing(mpg));
Categorías
Más información sobre Data Type Identification en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!