Problem 300. Remove NaN ?
Solution Stats
Problem Comments
-
2 Comments
goc3
on 24 Feb 2017
Additional test cases have been added.
Mia Buckley
on 22 Jul 2021
I have the same problem and need a solution.
Solution Comments
-
1 Comment
Pritesh Shah
on 1 Aug 2014
you can use find function... easy
-
2 Comments
rohit more
on 11 Mar 2013
function y = removeNaN(x)
[n m] = size(x);
for i = 1 : n
maxx = max(isnan(x(i,:)));
if maxx ~= 1
y = (x(i,:))
end
end
What is Wrong With THis Code CAn SomeOne Tell ME
Tim
on 11 Mar 2013
It looks like y will return only the last non-NaN row, instead of collecting all of them.
-
1 Comment
Carlos Adrian Vargas Aguilera
on 1 Jul 2013
Very nice!!
-
1 Comment
@bmtran (Bryant Tran)
on 9 Feb 2012
This solution doesn't necessarily work if there are any Inf elements in the matrix. Perhaps it would be best to add a test case where that is the case.
Problem Recent Solvers991
Suggested Problems
-
14139 Solvers
-
884 Solvers
-
Relative ratio of "1" in binary number
975 Solvers
-
923 Solvers
-
807 Solvers
More from this Author10
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!