Delete rows with NaN records
Afficher commentaires plus anciens
How can I delete rows which have NaN on one of the column.
Réponse acceptée
Plus de réponses (3)
Chris Turnes
le 7 Mar 2017
5 votes
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
le 12 Mar 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 commentaire
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
le 28 Déc 2022
0 votes
mpg = mpg(~ismissing(mpg));
Catégories
En savoir plus sur Data Type Identification dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!