Cody

Solution 1916342

Submitted on 30 Aug 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   Pass
x = 7; c_correct = {7}; assert(isequal(split_nan_delimited(x), c_correct ))

2   Fail
x = nan; assert(isempty(split_nan_delimited(x)) && iscell(split_nan_delimited(x)))

Assertion failed.

3   Fail
x = [nan; 7; 0; nan]; c_correct = {[7; 0]}; assert(isequal(split_nan_delimited(x), c_correct ))

Assertion failed.

4   Pass
x = rand(66,1); c_correct = {x}; assert(isequal(split_nan_delimited(x), c_correct ))

5   Pass
x = (1:20)'; c_correct = {x}; assert(isequal(split_nan_delimited(x), c_correct ))

6   Fail
x = [1 76 -inf 0 3 nan 16 7 2 1 0 0 inf 13]'; c_correct = {x(1:5) x(7:end)}; assert(isequal(split_nan_delimited(x), c_correct ))

Assertion failed.

7   Fail
x = (1:34)'; x([6:7 19:21 30]) = nan; c_correct = {x(1:5) x(8:18) x(22:29) x(31:end)}; assert(isequal(split_nan_delimited(x), c_correct ))

Assertion failed.

8   Fail
x = 10*rand(55,6)-5; x([1:2 6 13:15 40],:) = nan; c_correct = {x(3:5,:) x(7:12,:) x(16:39,:) x(41:end,:)}; assert(isequal(split_nan_delimited(x), c_correct ))

Assertion failed.

9   Fail
x = [nan(4); magic(4); nan(1,4); inf(4); ones(4)]; c_correct = {magic(4) [inf(4); ones(4)]}; assert(isequal(split_nan_delimited(x), c_correct ))

Assertion failed.

10   Fail
x = nan(6); c_correct = {}; assert(isempty(split_nan_delimited(x)) && iscell(split_nan_delimited(x)))

Assertion failed.

11   Fail
x = [nan(4); ones(1,4)]; c_correct = {ones(1,4)}; assert(isequal(split_nan_delimited(x), c_correct ))

Assertion failed.

Suggested Problems

More from this Author4