Cody

Problem 350. Back to basics 7 - Equal NaNs

Solution 1067879

Submitted on 1 Dec 2016 by suin kim
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:10]; y = x; z = true; assert(isequal(are_equal(x,y),z));

a = 1×0 empty double row vector b = 1×0 empty double row vector x = 1 2 3 4 5 6 7 8 9 10 y = 1 2 3 4 5 6 7 8 9 10 z = logical 1

2   Pass
x = [1:10 NaN]; y = x; z = true; assert(isequal(are_equal(x,y),z));

a = 11 b = 11 x = 1 2 3 4 5 6 7 8 9 10 1 y = 1 2 3 4 5 6 7 8 9 10 1 z = logical 1

3   Pass
x = [2 4 6 NaN 8]; y = [2 4 NaN 6 8]; z = false; assert(isequal(are_equal(x,y),z));

a = 4 b = 3 x = 2 4 6 1 8 y = 2 4 1 6 8 z = logical 0

Suggested Problems

More from this Author39

Community Treasure Hunt

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

Start Hunting!