Cody

# Problem 2230. Back to basics - array operations

Solution 1925166

Submitted on 7 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
x = magic(3); y = eye(3); operation = 'Add'; y_correct = true; assert(isequal(ArrayOperation(x,y,operation),y_correct))

ans = 3 3 ans = 3 3

Output argument "y" (and maybe others) not assigned during call to "ArrayOperation". Error in Test1 (line 5) assert(isequal(ArrayOperation(x,y,operation),y_correct))

2   Fail
x = magic(3); y = eye(2); operation = 'Add'; y_correct = false; assert(isequal(ArrayOperation(x,y,operation),y_correct))

ans = 3 3 ans = 2 2

Output argument "y" (and maybe others) not assigned during call to "ArrayOperation". Error in Test2 (line 5) assert(isequal(ArrayOperation(x,y,operation),y_correct))

3   Fail
x = magic(3); y = repmat(3,3,3); operation = 'Multiply'; y_correct = true; assert(isequal(ArrayOperation(x,y,operation),y_correct))

ans = 3 3 ans = 3 3

Output argument "y" (and maybe others) not assigned during call to "ArrayOperation". Error in Test3 (line 5) assert(isequal(ArrayOperation(x,y,operation),y_correct))

4   Fail
x = magic(3); y = repmat(3,3,2); operation = 'Multiply'; y_correct = true; assert(isequal(ArrayOperation(x,y,operation),y_correct))

ans = 3 3 ans = 3 2

Output argument "y" (and maybe others) not assigned during call to "ArrayOperation". Error in Test4 (line 5) assert(isequal(ArrayOperation(x,y,operation),y_correct))

5   Fail
x = 3; y = repmat(3,3,2); operation = 'Add'; y_correct = true; assert(isequal(ArrayOperation(x,y,operation),y_correct))

ans = 1 1 ans = 3 2

Output argument "y" (and maybe others) not assigned during call to "ArrayOperation". Error in Test5 (line 5) assert(isequal(ArrayOperation(x,y,operation),y_correct))

6   Fail
x = 3; y = repmat(3,3,2); operation = 'Subtract'; y_correct = true; assert(isequal(ArrayOperation(x,y,operation),y_correct))

ans = 1 1 ans = 3 2

Output argument "y" (and maybe others) not assigned during call to "ArrayOperation". Error in Test6 (line 5) assert(isequal(ArrayOperation(x,y,operation),y_correct))

7   Fail
x = 3; y = repmat(3,3,2); operation = 'Divide'; y_correct = false; assert(isequal(ArrayOperation(x,y,operation),y_correct))

ans = 1 1 ans = 3 2

Output argument "y" (and maybe others) not assigned during call to "ArrayOperation". Error in Test7 (line 5) assert(isequal(ArrayOperation(x,y,operation),y_correct))

8   Fail
x = 3; y = repmat(3,3,2); operation = 'Divide'; y_correct = true; assert(isequal(ArrayOperation(y,x,operation),y_correct))

ans = 3 2 ans = 1 1

Output argument "y" (and maybe others) not assigned during call to "ArrayOperation". Error in Test8 (line 5) assert(isequal(ArrayOperation(y,x,operation),y_correct))