Sum of Positive Elements in a Matrix - MATLAB Cody - MATLAB Central

Problem 60819. Sum of Positive Elements in a Matrix

Difficulty:Rate
Given a matrix A, write a function that returns the sum of all positive elements in A.
Input:
A = [-3, 4, -1; 6, -2, 8]
Output:
y = 18

Solution Stats

51.72% Correct | 48.28% Incorrect
Last Solution submitted on Jun 20, 2025

Solution Comments

Show comments
Why should you share code?
In a discussion on LInkedin about my recent blog post, Do these...
1
3

Problem Recent Solvers14

Suggested Problems

More from this Author1

Problem Tags

Community Treasure Hunt

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

Start Hunting!