Cody

Problem 44480. The average of the second largest values

Solution 2266121

Submitted on 9 May 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 3 4;8 7 6 5;9 0 1 4]; y_correct = (3 + 7 + 4) / 3; assert(isequal(ave_2ndM(x),y_correct))

t = 1 2 3 t = 7 6 5 t = 0 1 4

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

2   Fail
x = [2 4 ;5 9; 0 5;88 52]; y_correct = (2 + 5 + 0 + 52) / 4; assert(isequal(ave_2ndM(x),y_correct))

t = 2 t = 5 t = 0 t = 52

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

3   Fail
x = [97 93 68 58 24 74 55 49 40 24 63 53 46 37 19]; y_correct = (93 + 55 + 53) / 3; assert(isequal(ave_2ndM(x),y_correct))

t = 93 68 58 24 t = 55 49 40 24 t = 53 46 37 19

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

4   Fail
x = [ 82 65 14 40 44 73 81 18 53 2 15 46 40 42 99 66 44 84 66 17 52 83 81 63 11 98 9 7 30 38]; y_correct = 61.5; assert(isequal(ave_2ndM(x),y_correct))

t = 65 14 40 44 t = 73 18 53 2 t = 15 46 40 42 t = 66 44 66 17 t = 52 81 63 11 t = 9 7 30 38

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

Suggested Problems

More from this Author9

Community Treasure Hunt

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

Start Hunting!