Cody

# Problem 42671. unique with nan

Solution 1605688

Submitted on 10 Aug 2018 by goc3
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 = [2 NaN 3 5 NaN; 1 NaN 4 9 NaN; 8 -2 7 6 -2; 7 4 8 5 4];; y_correct = [2 NaN 3 5; 1 NaN 4 9; 8 -2 7 6; 7 4 8 5]; assert(isequalwithequalnans(unique_with_nan(x),y_correct))

y = 2 NaN 3 5 1 NaN 4 9 8 -2 7 6 7 4 8 5

2   Pass
x = [1 0 0 1;NaN 1 0 NaN;NaN 0 1 NaN;0 0 0 0]; y_correct = [1 0 0;NaN 1 0;NaN 0 1;0 0 0]; assert(isequalwithequalnans(unique_with_nan(x),y_correct))

y = 1 0 0 NaN 1 0 NaN 0 1 0 0 0

3   Pass
x = [1 0 1 1 1 1 0;0 1 1 1 1 1 0;0 0 NaN NaN NaN NaN 0;0 0 NaN NaN NaN NaN 0;0 0 NaN NaN NaN NaN 0;0 0 0 0 0 0 0;0 0 0 0 0 0 1]; y_correct = [1 0 1 0;0 1 1 0;0 0 NaN 0;0 0 NaN 0;0 0 NaN 0;0 0 0 0;0 0 0 1]; assert(isequalwithequalnans(unique_with_nan(x),y_correct))

y = 1 0 1 0 0 1 1 0 0 0 NaN 0 0 0 NaN 0 0 0 NaN 0 0 0 0 0 0 0 0 1

4   Pass
x = [2 NaN 3 5 NaN; 1 NaN 4 9 NaN; 8 pi 7 6 pi; 7 eps 8 5 eps]; y_correct = [2 NaN 3 5; 1 NaN 4 9; 8 pi 7 6; 7 eps 8 5]; assert(isequalwithequalnans(unique_with_nan(x),y_correct))

y = 2.0000 NaN 3.0000 5.0000 1.0000 NaN 4.0000 9.0000 8.0000 3.1416 7.0000 6.0000 7.0000 0.0000 8.0000 5.0000

### Community Treasure Hunt

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

Start Hunting!