Cody

# Problem 44031. Matrix Manipulation

Solution 1206798

Submitted on 7 Jun 2017
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
x = [3 2 1 3; 3 0 0 1; 0 4 3 1]; y = matrixManipulation(x); v = 3:15; assert(isequal(x(1,:),y(1,:))) assert(isempty(setdiff(y(2,:),v))) assert(isempty(setdiff(y(3,:),v)))

cnum = 4 fg = 3×1 logical array 1 1 1

Error using randi First input must be a positive scalar integer value IMAX, or two integer values [IMIN IMAX] with IMIN less than or equal to IMAX. Error in matrixManipulation (line 4) x(fg)=randi([3:15], [1 cnum]) Error in TestPoint1 (line 2) y = matrixManipulation(x);

2   Fail
x = eye(4); y = matrixManipulation(x); v = 3:15; for i = 1:4 assert(isempty(setdiff(y(i,:),v))) end

cnum = 4 fg = 4×1 logical array 1 1 1 1

Error using randi First input must be a positive scalar integer value IMAX, or two integer values [IMIN IMAX] with IMIN less than or equal to IMAX. Error in matrixManipulation (line 4) x(fg)=randi([3:15], [1 cnum]) Error in TestPoint2 (line 2) y = matrixManipulation(x);

3   Fail
x = ones(4); y = matrixManipulation(x); assert(isequal(x,y))

cnum = 4 fg = 4×1 logical array 1 1 1 1

Error using randi First input must be a positive scalar integer value IMAX, or two integer values [IMIN IMAX] with IMIN less than or equal to IMAX. Error in matrixManipulation (line 4) x(fg)=randi([3:15], [1 cnum]) Error in TestPoint3 (line 2) y = matrixManipulation(x);