Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 208013

Submitted on 24 Feb 2013

Incorrect

80Size
Leading solution size is 41.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Fail
 
%%
row_sums = [3 5 11];
col_sums = [4 7 8];
x = matcat(row_sums,col_sums);
assert(all(x(:)>=0))
assert(isequal(floor(x),x))
assert(isequal(sum(x,2)',row_sums))
assert(isequal(sum(x,1),col_sums))
Error: Undefined function 'matcat' for input arguments of type 'double'.
2
Fail
 
%%
row_sums = [2 2 2 2 2 6];
col_sums = [2 3 3 3 3 2];
x = matcat(row_sums,col_sums);
assert(all(x(:)>=0))
assert(isequal(floor(x),x))
assert(isequal(sum(x,2)',row_sums))
assert(isequal(sum(x,1),col_sums))
Error: Undefined function 'matcat' for input arguments of type 'double'.
3
Fail
 
%%
row_sums = [65 65 65 65 65];
col_sums = [65 65 65 65 65];
x = matcat(row_sums,col_sums);
assert(all(x(:)>=0))
assert(isequal(floor(x),x))
assert(isequal(sum(x,2)',row_sums))
assert(isequal(sum(x,1),col_sums))
Error: Undefined function 'matcat' for input arguments of type 'double'.
4
Fail
 
%%
row_sums = [22 34 33];
col_sums = [15 23 18 21 12];
x = matcat(row_sums,col_sums);
assert(all(x(:)>=0))
assert(isequal(floor(x),x))
assert(isequal(sum(x,2)',row_sums))
assert(isequal(sum(x,1),col_sums))
Error: Undefined function 'matcat' for input arguments of type 'double'.
5
Fail
 
%%
row_sums = 55;
col_sums = [1 2 3 4 5 6 7 8 9 10];
x = matcat(row_sums,col_sums);
assert(all(x(:)>=0))
assert(isequal(floor(x),x))
assert(isequal(sum(x,2)',row_sums))
assert(isequal(sum(x,1),col_sums))
Error: Undefined function 'matcat' for input arguments of type 'double'.