Cody

Problem 44401. Vertical matrix sort

Solution 1339103

Submitted on 13 Nov 2017
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Fail
x = []; y_correct = []; assert(isequal(upAndDown(x),y_correct))

Undefined function or variable 'A'. Error in upAndDown (line 2) [sort(A); flipud(sort(A))] Error in Test1 (line 3) assert(isequal(upAndDown(x),y_correct))

2   Fail
x = 0; y_correct = [0;0]; assert(isequal(upAndDown(x),y_correct))

Undefined function or variable 'A'. Error in upAndDown (line 2) [sort(A); flipud(sort(A))] Error in Test2 (line 3) assert(isequal(upAndDown(x),y_correct))

3   Fail
x = [1 2 3 4]; y_correct = [1 2 3 4; 1 2 3 4]; assert(isequal(upAndDown(x),y_correct))

Undefined function or variable 'A'. Error in upAndDown (line 2) [sort(A); flipud(sort(A))] Error in Test3 (line 3) assert(isequal(upAndDown(x),y_correct))

4   Fail
x = [8 9 3 9; 9 6 5 2; 2 1 9 9]; y_correct = [2 1 3 2; 8 6 5 9; 9 9 9 9; 9 9 9 9; 8 6 5 9; 2 1 3 2]; assert(isequal(upAndDown(x),y_correct))

Undefined function or variable 'A'. Error in upAndDown (line 2) [sort(A); flipud(sort(A))] Error in Test4 (line 4) assert(isequal(upAndDown(x),y_correct))

Suggested Problems

More from this Author25

Community Treasure Hunt

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

Start Hunting!