Cody

Problem 43305. Sum positive elements of matrix.

Solution 1120826

Submitted on 11 Feb 2017 by Jihye Sofia Seo
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 = [-5 1 6; -5 5 -5; 4 9 2]; y_correct = 27; assert(isequal(your_fcn_name(x),y_correct))

x = -5 -5 4 1 5 9 6 -5 2 pL = 9×1 logical array 0 0 1 1 1 1 1 0 1 y = 27

2   Pass
x = [ -2 2 -2 13; 5 11 10 8; -2 7 -2 12; 4 14 15 1]; y_correct = 102; assert(isequal(your_fcn_name(x),y_correct))

x = -2 5 -2 4 2 11 7 14 -2 10 -2 15 13 8 12 1 pL = 16×1 logical array 0 1 0 1 1 1 1 1 0 1 0 1 1 1 1 1 y = 102

Suggested Problems

More from this Author37

Community Treasure Hunt

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

Start Hunting!