Problem 25. Remove any row in which a NaN appears
Given the matrix A, return B in which all the rows that have one or more NaNs have been removed. So for
A = [ 1 5 8 -3 NaN 14 0 6 NaN ];
then
B = [ 1 5 8 ]
Solution Stats
Problem Comments
-
19 Comments
It's a good problem!
very good problem
ya.. but not so difficult though
nice trick with the " ' "))
very good problem
I really like this problem. It makes me to improve my solutions again and again. But it seems that I still use too many loops....
lol test case with transform was good one!
do not understand how one get so efficient solution on this (and to be honest other problems as well)
thanks you very much.
Why doesn't this work? It works when I use it on my computer...
function B = remove_nan_rows(A)
B = A;
B(any(isnan(A')),:) = [];
end
MATLABotic!
These types of problems are giving me so many useful functions
A(~sum(isnan(A),2),:) this workde for me
Cool!
Very good problem!
A easy problem if you know fuction isnan.
Nice one!
Oh
Easy one
Solution Comments
Show commentsProblem Recent Solvers8548
Suggested Problems
-
Remove all the words that end with "ain"
2223 Solvers
-
Determine if a Given Number is a Triangle Number
370 Solvers
-
Back to basics 25 - Valid variable names
322 Solvers
-
Convert a vector into a number
594 Solvers
-
Reverse the elements of an array
1002 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!