Cody

Problem 694. Remove NaNs and numbers adjacent to NaNs

Solution 1625867

Submitted on 12 Sep 2018 by Michael Cappello
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   Pass
x=[1 2 3 NaN 4 5 6]; y_correct=[1 2 5 6]; assert(isequal(NaN_window_delete(x),y_correct))

idx = 4 idx = 3 4 5 idx = 3 4 5 x = 1 2 5 6

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

idx = 4 7 idx = 3 6 4 7 5 8 idx = 3 6 4 7 5 8 x = 10 20

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

idx = 1 8 idx = 7 1 8 2 9 idx = 7 1 8 2 x = 3 5 4 50

4   Pass
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))

idx = 5 9 13 idx = 4 8 12 5 9 13 6 10 14 idx = 4 8 12 5 9 13 6 10 14 x = 10 20 3 50 80 110

Suggested Problems

More from this Author241

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!