Problem 300. Remove NaN ?
40.93% Correct | 59.07% Incorrect
Last Solution submitted on Mar 23, 2023
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.
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,:))
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.
@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 Solvers990
Find relatively common elements in matrix rows
More from this Author10
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!