Cody

Solution 1596796

Submitted on 31 Jul 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
x = [1:6]'; n = 3; y_correct = [1 NaN NaN NaN 2 1 NaN NaN 3 2 1 NaN 4 3 2 1 5 4 3 2 6 5 4 3]; assert(isequalwithequalnans(goNtimes(x,n),y_correct))

Error using ones Size inputs must be scalar. Error in goNtimes (line 4) y=[y [nan*ones(1:k,1);x(1:end-k)]]; Error in Test1 (line 9) assert(isequalwithequalnans(goNtimes(x,n),y_correct))

2   Fail
x = [17;23;4;10;11]; n = 4; y_correct = [17 NaN NaN NaN NaN 23 17 NaN NaN NaN 4 23 17 NaN NaN 10 4 23 17 NaN 11 10 4 23 17]; assert(isequalwithequalnans(goNtimes(x,n),y_correct))

Error using ones Size inputs must be scalar. Error in goNtimes (line 4) y=[y [nan*ones(1:k,1);x(1:end-k)]]; Error in Test2 (line 8) assert(isequalwithequalnans(goNtimes(x,n),y_correct))

3   Pass
x = [35;3;31;8;30;4]; n = 1; y_correct = [35 NaN 3 35 31 3 8 31 30 8 4 30]; assert(isequalwithequalnans(goNtimes(x,n),y_correct))

4   Fail
x = [35;3;31;8;30;4]; n = 2; y_correct = [35 NaN NaN 3 35 NaN 31 3 35 8 31 3 30 8 31 4 30 8]; assert(isequalwithequalnans(goNtimes(x,n),y_correct))

Error using ones Size inputs must be scalar. Error in goNtimes (line 4) y=[y [nan*ones(1:k,1);x(1:end-k)]]; Error in Test4 (line 9) assert(isequalwithequalnans(goNtimes(x,n),y_correct))

5   Fail
x = [30;38;46;5;13;21;22]; n = 4; y_correct = [30 NaN NaN NaN NaN 38 30 NaN NaN NaN 46 38 30 NaN NaN 5 46 38 30 NaN 13 5 46 38 30 21 13 5 46 38 22 21 13 5 46]; assert(isequalwithequalnans(goNtimes(x,n),y_correct))

Error using ones Size inputs must be scalar. Error in goNtimes (line 4) y=[y [nan*ones(1:k,1);x(1:end-k)]]; Error in Test5 (line 10) assert(isequalwithequalnans(goNtimes(x,n),y_correct))