Cody

Problem 2493. Must be in the front row...

Solution 3231663

Submitted on 16 Oct 2020
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
matrix=magic(4); value=6; y_correct=[6 12 9 7; 15 1 4 14; 3 13 16 2; 10 8 5 11]; assert(isequal(front_row(matrix,value),y_correct))

Unable to perform assignment because the size of the left side is 4-by-0 and the size of the right side is 4-by-2. Error in front_row (line 7) C(:,c:end)=B(:,1:c-1); Error in Test1 (line 4) assert(isequal(front_row(matrix,value),y_correct))

2   Fail
matrix=magic(5); value=3; matrix(3,2)=value; y_correct=[3 13 20 22 4; 12 19 21 3 10; 18 25 2 9 11; 24 1 8 15 17; 5 7 14 16 23]; assert(isequal(front_row(matrix,value),y_correct))

Unable to perform assignment because the size of the left side is 2-by-5 and the size of the right side is 3-by-5. Error in front_row (line 4) B(1:r-1,:)=matrix(r:end,:); Error in Test2 (line 5) assert(isequal(front_row(matrix,value),y_correct))

3   Fail
matrix=magic(7); value=500; assert(isequal(front_row(matrix,value),matrix))

y = 7×0 empty double matrix

Assertion failed.

Suggested Problems

More from this Author80

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!