Cody

Solution 552860

Submitted on 6 Jan 2015
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   Pass
%% x = nan; assert(isempty(split_nan_delimited(x)) && iscell(split_nan_delimited(x)))

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

Error: Input arguments, D1 through D2, must sum to each dimension of the input matrix size, [4 1].'

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

Error: Input arguments, D1 through D2, must sum to each dimension of the input matrix size, [66 1].'

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

Error: Input arguments, D1 through D2, must sum to each dimension of the input matrix size, [20 1].'

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

Error: Input arguments, D1 through D2, must sum to each dimension of the input matrix size, [14 1].'

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

Error: Input arguments, D1 through D2, must sum to each dimension of the input matrix size, [34 1].'

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

Error: Input arguments, D1 through D2, must sum to each dimension of the input matrix size, [55 6].'

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

Error: Input arguments, D1 through D2, must sum to each dimension of the input matrix size, [17 4].'

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

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

Error: Input arguments, D1 through D2, must sum to each dimension of the input matrix size, [5 4].'