Cody

# Problem 1923. Find the maximum two numbers of every column of a matrix

Solution 2271710

Submitted on 11 May 2020 by Anvitha S
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   Pass
x = [1 2 4; 6 0 3; 4 1 5]; y_correct = [6 2 5; 4 1 4]; assert(isequal(your_fcn_name(x),y_correct))

temp = 6 4 1 m = 6 4 temp = 2 1 0 m = 6 2 4 1 temp = 5 4 3 m = 6 2 5 4 1 4

2   Pass
x = ones(3); y_correct = ones(2,3); assert(isequal(your_fcn_name(x),y_correct))

temp = 1 1 1 m = 1 1 temp = 1 1 1 m = 1 1 1 1 temp = 1 1 1 m = 1 1 1 1 1 1

3   Pass
x = eye(4); y_correct = [ones(1,4); zeros(1,4)]; assert(isequal(your_fcn_name(x),y_correct))

temp = 1 0 0 0 m = 1 0 temp = 1 0 0 0 m = 1 1 0 0 temp = 1 0 0 0 m = 1 1 1 0 0 0 temp = 1 0 0 0 m = 1 1 1 1 0 0 0 0

4   Pass
x = [1:5; 6:10; 11:15; 16:20; 21:25]; y_correct = [21:25; 16:20]; assert(isequal(your_fcn_name(x),y_correct))

temp = 21 16 11 6 1 m = 21 16 temp = 22 17 12 7 2 m = 21 22 16 17 temp = 23 18 13 8 3 m = 21 22 23 16 17 18 temp = 24 19 14 9 4 m = 21 22 23 24 16 17 18 19 temp = 25 20 15 10 5 m = 21 22 23 24 25 16 17 18 19 20

5   Pass
x = [1 5 7 3 47 2 3; 6 7 1 5 23 1 47; 7 1 3 2 68 4 11]; y_correct = [7 7 7 5 68 4 47; 6 5 3 3 47 2 11]; assert(isequal(your_fcn_name(x),y_correct))

temp = 7 6 1 m = 7 6 temp = 7 5 1 m = 7 7 6 5 temp = 7 3 1 m = 7 7 7 6 5 3 temp = 5 3 2 m = 7 7 7 5 6 5 3 3 temp = 68 47 23 m = 7 7 7 5 68 6 5 3 3 47 temp = 4 2 1 m = 7 7 7 5 68 4 6 5 3 3 47 2 temp = 47 11 3 m = 7 7 7 5 68 4 47 6 5 3 3 47 2 11

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!