Additional test cases have been added.
function y = removeNaN(x)
y=x;
[a,~]=find(isnan(x));
y(a,:)=[];
end
you can use find function... easy
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
It looks like y will return only the last non-NaN row, instead of collecting all of them.
Very nice!!
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.
What is the distance from point P(x,y) to the line Ax + By + C = 0?
277 Solvers
746 Solvers
Relative ratio of "1" in binary number
392 Solvers
338 Solvers
Convert a Cell Array into an Array
430 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!