Cody

Solution 1942719

Submitted on 19 Sep 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
m = magic(5); n = ones(2,3); o = [2 3]; y_correct = [7,14,16;13,20,22]; assert(isequal(cookiecutter(m,n,o),y_correct))

Matrix dimensions must agree. Error in cookiecutter (line 3) m(o(1)+(0:size(o,1)-1),o(2)+(0:size(o,2)-1)).*n Error in Test1 (line 5) assert(isequal(cookiecutter(m,n,o),y_correct))

2   Fail
m = 1; n = 8; o = [1 1]; y_correct = 8; assert(isequal(cookiecutter(m,n,o),y_correct))

Index in position 2 exceeds array bounds (must not exceed 1). Error in cookiecutter (line 3) m(o(1)+(0:size(o,1)-1),o(2)+(0:size(o,2)-1)).*n Error in Test2 (line 5) assert(isequal(cookiecutter(m,n,o),y_correct))

3   Fail
m = magic(20); n = ones(3); o = [17 17]; y_correct = [64,338,339;357,43,42;377,23,22]; assert(isequal(cookiecutter(m,n,o),y_correct))

Matrix dimensions must agree. Error in cookiecutter (line 3) m(o(1)+(0:size(o,1)-1),o(2)+(0:size(o,2)-1)).*n Error in Test3 (line 5) assert(isequal(cookiecutter(m,n,o),y_correct))

4   Fail
m = magic(20); n = 5.*ones(2,3); o = [4 10]; y_correct = [350,355,1645;450,455,1545]; assert(isequal(cookiecutter(m,n,o),y_correct))

Matrix dimensions must agree. Error in cookiecutter (line 3) m(o(1)+(0:size(o,1)-1),o(2)+(0:size(o,2)-1)).*n Error in Test4 (line 5) assert(isequal(cookiecutter(m,n,o),y_correct))

5   Fail
m = magic(7); m=m(:,1:end-1); n = spiral(3); o = [5 4]; y_correct = [231,336,396;246,43,6;245,8,33]; assert(isequal(cookiecutter(m,n,o),y_correct))

Matrix dimensions must agree. Error in cookiecutter (line 3) m(o(1)+(0:size(o,1)-1),o(2)+(0:size(o,2)-1)).*n Error in Test5 (line 6) assert(isequal(cookiecutter(m,n,o),y_correct))