Cody

Solution 2169774

Submitted on 22 Mar 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
x = [1 2 6; 2 7 5; 3 5 4]; co1 = [1 2 4; 3 7 6]; co2 = [1 1 3; 3 2 1]; [o1, o2] = dispatch(x, @min, @max); assert(isequal(o1, co1) && isequal(o2, co2))

ans = 2 varargout = 1×1 cell array {1×3 double} varargout = 1×2 cell array {1×3 double} {1×3 double}

Assertion failed.

2   Fail
x = randi(50, 20); co = [mean(x); mode(x); median(x)]; assert(isequal(co, dispatch(x, @mean, @mode, @median)))

ans = 1 varargout = 1×1 cell array {1×20 double}

Assertion failed.

3   Fail
x=10; co = [zeros(x);ones(x);eye(x);magic(x);pascal(x)]; assert(isequal(co, dispatch(x, @zeros, @ones, @eye, @magic, @pascal)))

ans = 1 varargout = 1×1 cell array {1×10 double}

Assertion failed.

4   Fail
co = randi(50, 1, 4); [o1, o2, o3, o4] = dispatch(zeros(co), @size); assert(isequal([o1 o2 o3 o4], co))

ans = 4 varargout = 1×1 cell array {1×4 double}

Index in position 1 exceeds array bounds (must not exceed 1). Error in dispatch (line 11) varargout{i}=R(i,:) Error in Test4 (line 2) [o1, o2, o3, o4] = dispatch(zeros(co), @size);

Suggested Problems

More from this Author9