Cody

Solution 2613469

Submitted on 25 Jun 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
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))

ans = 0 1 0 ans = 1 2 2 ans = 4 4 5

Output argument "x" (and maybe others) not assigned during call to "matcat". Error in Test1 (line 3) x = matcat(row_sums,col_sums);

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))

ans = 0 1 1 0 0 0 ans = 0 1 0 1 1 1

Output argument "x" (and maybe others) not assigned during call to "matcat". Error in Test2 (line 3) x = matcat(row_sums,col_sums);

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))

ans = 25 14 4 3 23 ans = 29 3 17 26 19 ans = 11 6 22 12 16 ans = 0 21 9 1 17 ans = 25 9 6 18 23

Index exceeds the number of array elements (5). Error in matcat (line 4) randi([0 floor(row_sums(i)/2)],[1 s1]) Error in Test3 (line 3) x = matcat(row_sums,col_sums);

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))

ans = 8 10 1 ans = 10 4 2 ans = 2 16 2

Index exceeds the number of array elements (3). Error in matcat (line 4) randi([0 floor(row_sums(i)/2)],[1 s1]) Error in Test4 (line 3) x = matcat(row_sums,col_sums);

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))

ans = 5

Index exceeds the number of array elements (1). Error in matcat (line 4) randi([0 floor(row_sums(i)/2)],[1 s1]) Error in Test5 (line 3) x = matcat(row_sums,col_sums);

Suggested Problems

More from this Author49