Given a square matrix as input, write a function that returns the sum of all elements above the main diagonal.
If the input matrix is empty ([]), the output must also be empty ([]).
Your solution must use exactly one for loop.
Note: Some built-in MATLAB functions are disabled for this problem.

Solution Stats

6 Solutions

5 Solvers

Last Solution submitted on Jul 14, 2026

Last 200 Solutions

Solution Comments

Show comments
Loading...

Problem Recent Solvers5

Suggested Problems

More from this Author12

Problem Tags

Community Treasure Hunt

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

Start Hunting!