Cody

Solution 1899349

Submitted on 13 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   Fail
A = 1; IND = 1; b = 1; y_correct = [1;1]; assert(isequal(insertRows(A, IND, b), y_correct))

Output argument "y" (and maybe others) not assigned during call to "insertRows". Error in Test1 (line 5) assert(isequal(insertRows(A, IND, b), y_correct))

2   Fail
A = [0 0; 1 1]; IND = [1 1 1 2]; b = NaN; y_correct = [0 0;NaN NaN;NaN NaN;NaN NaN;1 1;NaN NaN]; assert(isequalwithequalnans(insertRows(A, IND, b), y_correct))

Index in position 1 exceeds array bounds (must not exceed 1). Error in insertRows (line 6) A(IND(ii)+jj+1,:)=b(ii,:); Error in Test2 (line 5) assert(isequalwithequalnans(insertRows(A, IND, b), y_correct))

3   Fail
A = [1 1; 3 3; 4 4]; IND = [1 3]; b = [2 2; 5 5]; y_correct = [1 1;2 2;3 3;4 4;5 5]; assert(isequal(insertRows(A, IND, b), y_correct))

Output argument "y" (and maybe others) not assigned during call to "insertRows". Error in Test3 (line 5) assert(isequal(insertRows(A, IND, b), y_correct))

4   Fail
A = (1:2:10)'; IND = 1:5; b = (2:2:10)'; y_correct = (1:10)'; assert(isequal(insertRows(A, IND, b), y_correct))

Unable to perform assignment because the size of the left side is 5-by-1 and the size of the right side is 4-by-1. Error in insertRows (line 11) A(IND(ii)+2:size(A,1)+jj,:)=C(IND(ii)+1:end,:); Error in Test4 (line 5) assert(isequal(insertRows(A, IND, b), y_correct))

5   Fail
A = zeros(10,5); IND = [3,7]; b = rand(2,5); y_correct = [zeros(3,5); b(1,:); zeros(4,5); b(2,:); zeros(3,5)]; assert(isequal(insertRows(A, IND, b), y_correct))

Unable to perform assignment because the size of the left side is 5-by-5 and the size of the right side is 4-by-5. Error in insertRows (line 11) A(IND(ii)+2:size(A,1)+jj,:)=C(IND(ii)+1:end,:); Error in Test5 (line 5) assert(isequal(insertRows(A, IND, b), y_correct))

6   Pass
assert(isempty(strfind(evalc('type insertRows'), 'regexp')));

Suggested Problems

More from this Author1