Problem 300. Remove NaN ?
Additional test cases have been added.
I have the same problem and need a solution.
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
It looks like y will return only the last non-NaN row, instead of collecting all of them.
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
Create a vector whose elements depend on the previous element
Determine the number of odd integers in a vector
More from this Author10
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!