Cody

Solution 1564791

Submitted on 20 Jun 2018
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   Fail
v = [2 18 9 6 11 20 25 3]; n_correct = 4; assert(isequal(subseq(v),n_correct))

Error using cellfun Unknown option. Error in subseq (line 2) sum(max(cellfun('numel',regexp(num2str(diff(v)>0,-6),'1+','match'))))+1; Error in Test1 (line 3) assert(isequal(subseq(v),n_correct))

2   Fail
v = [-6 -18 -9 -4 -11 -20 -25 -3]; n_correct = 3; assert(isequal(subseq(v),n_correct))

Error using cellfun Unknown option. Error in subseq (line 2) sum(max(cellfun('numel',regexp(num2str(diff(v)>0,-6),'1+','match'))))+1; Error in Test2 (line 3) assert(isequal(subseq(v),n_correct))

3   Fail
v = zeros(1,30); n_correct = 1; assert(isequal(subseq(v),n_correct))

Error using cellfun Unknown option. Error in subseq (line 2) sum(max(cellfun('numel',regexp(num2str(diff(v)>0,-6),'1+','match'))))+1; Error in Test3 (line 3) assert(isequal(subseq(v),n_correct))

4   Fail
v = [exp(-1) sqrt(2) sqrt(3) exp(1) pi exp(2)]; n_correct = 6; assert(isequal(subseq(v),n_correct))

Error using cellfun Unknown option. Error in subseq (line 2) sum(max(cellfun('numel',regexp(num2str(diff(v)>0,-6),'1+','match'))))+1; Error in Test4 (line 3) assert(isequal(subseq(v),n_correct))

5   Fail
v = 100:-10:-100; n_correct = 1; assert(isequal(subseq(v),n_correct))

Error using cellfun Unknown option. Error in subseq (line 2) sum(max(cellfun('numel',regexp(num2str(diff(v)>0,-6),'1+','match'))))+1; Error in Test5 (line 3) assert(isequal(subseq(v),n_correct))

6   Fail
v = [0:5 1:7 3:9 2:8]; n_correct = 7; assert(isequal(subseq(v),n_correct))

Error using cellfun Unknown option. Error in subseq (line 2) sum(max(cellfun('numel',regexp(num2str(diff(v)>0,-6),'1+','match'))))+1; Error in Test6 (line 3) assert(isequal(subseq(v),n_correct))

Suggested Problems

More from this Author34