Cody

Problem 42665. sort matrix

Solution 2122689

Submitted on 9 Feb 2020 by Asif Newaz
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

2   Pass
x = 1; y_correct = 1; assert(isequal(SortMatrix(x),y_correct))

y = 1 y = 1

3   Pass
x = [1 3; 2 4;1 5;3 6]; y_correct = [1 3; 1 5;2 4; 3 6]; assert(isequal(SortMatrix(x),y_correct))

y = 3 6 2 4 1 5 1 3 y = 1 3 1 5 2 4 3 6

4   Pass
x = [4 5 6 3 5 8 3 4 10 2 6 10 2 5 12 1 10 12 2 4 15 1 8 15 2 3 20 1 6 20 1 5 24 2 2 30 1 4 30 1 3 40 1 2 60 1 1 120]; y_correct = [ 1 1 120 ; 1 2 60 ; 1 3 40 ; 1 4 30 ; 1 5 24 ; 1 6 20 ; 1 8 15 ; 1 10 12 ; 2 2 30 ; 2 3 20 ; 2 4 15 ; 2 5 12 ; 2 6 10 ; 3 4 10 ; 3 5 8 ; 4 5 6 ]; assert(isequal(SortMatrix(x),y_correct))

y = 4 5 6 3 5 8 3 4 10 2 6 10 2 5 12 2 4 15 2 3 20 2 2 30 1 10 12 1 8 15 1 6 20 1 5 24 1 4 30 1 3 40 1 2 60 1 1 120 y = 1 1 120 1 2 60 1 3 40 1 4 30 1 5 24 1 6 20 1 8 15 1 10 12 2 2 30 2 3 20 2 4 15 2 5 12 2 6 10 3 4 10 3 5 8 4 5 6

Community Treasure Hunt

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

Start Hunting!