Cody

Problem 694. Remove NaNs and numbers adjacent to NaNs

Solution 1120752

Submitted on 11 Feb 2017
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=[1 2 3 NaN 4 5 6]; y_correct=[1 2 5 6]; assert(isequal(NaN_window_delete(x),y_correct))

nLoc = 4 floc = 3 4 5

Deletion requires an existing variable. Error in NaN_window_delete (line 5) y(floc)=[]; Error in TestPoint1 (line 3) assert(isequal(NaN_window_delete(x),y_correct))

2   Fail
x=[10 20 3 NaN 4 50 NaN 6]; y_correct=[10 20]; assert(isequal(NaN_window_delete(x),y_correct))

nLoc = 4 7 floc = 3 4 5 6 7 8

Deletion requires an existing variable. Error in NaN_window_delete (line 5) y(floc)=[]; Error in TestPoint2 (line 3) assert(isequal(NaN_window_delete(x),y_correct))

3   Fail
x=[NaN 20 3 5 4 50 55 NaN]; y_correct=[3 5 4 50]; assert(isequal(NaN_window_delete(x),y_correct))

nLoc = 1 8 floc = 1 2 7 8

Deletion requires an existing variable. Error in NaN_window_delete (line 5) y(floc)=[]; Error in TestPoint3 (line 3) assert(isequal(NaN_window_delete(x),y_correct))

4   Fail
x=[10 20 3 5 NaN 4 50 55 NaN 60 80 90 NaN 100 110 ]; y_correct=[10 20 3 50 80 110]; assert(isequal(NaN_window_delete(x),y_correct))

nLoc = 5 9 13 floc = 4 5 6 8 9 10 12 13 14

Deletion requires an existing variable. Error in NaN_window_delete (line 5) y(floc)=[]; Error in TestPoint4 (line 3) assert(isequal(NaN_window_delete(x),y_correct))