Cody

Solution 2050679

Submitted on 8 Dec 2019
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
x = magic(3);x(2,[1 3])= NaN; y_correct = [8 1 6;4 9 2]; assert(isequal(removeNaN(x),y_correct))

y = 8 1 6

Index exceeds the number of array elements (1). Error in removeNaN (line 7) if maxx(i) == 0 Error in Test1 (line 3) assert(isequal(removeNaN(x),y_correct))

2   Fail
x = [magic(4) ones(4,1)]; x(4,5) = NaN;x(3,2) = Inf;x(3,1)=NaN; y_correct = x(1:2,:); assert(isequal(removeNaN(x),y_correct))

y = 16 2 3 13 1

Index exceeds the number of array elements (1). Error in removeNaN (line 7) if maxx(i) == 0 Error in Test2 (line 4) assert(isequal(removeNaN(x),y_correct))

3   Fail
x = ones(4);x(3,3)=NaN; y_correct = ones(3,4); assert(isequal(removeNaN(x),y_correct))

y = 1 1 1 1

Index exceeds the number of array elements (1). Error in removeNaN (line 7) if maxx(i) == 0 Error in Test3 (line 3) assert(isequal(removeNaN(x),y_correct))

4   Fail
x = [1; NaN]; y_correct = [1]; assert(isequal(removeNaN(x),y_correct))

y = 1

Index exceeds the number of array elements (1). Error in removeNaN (line 7) if maxx(i) == 0 Error in Test4 (line 3) assert(isequal(removeNaN(x),y_correct))

5   Fail
x = NaN; assert(isempty(removeNaN(x)))

Output argument "y" (and maybe others) not assigned during call to "removeNaN". Error in Test5 (line 2) assert(isempty(removeNaN(x)))

6   Fail
x = [1:10 NaN]; assert(isempty(removeNaN(x)))

Output argument "y" (and maybe others) not assigned during call to "removeNaN". Error in Test6 (line 2) assert(isempty(removeNaN(x)))

7   Fail
x = [1:10 NaN]'; y_correct = [1:10]'; assert(isequal(removeNaN(x),y_correct))

y = 1

Index exceeds the number of array elements (1). Error in removeNaN (line 7) if maxx(i) == 0 Error in Test7 (line 3) assert(isequal(removeNaN(x),y_correct))