Covering some basic topics I haven't seen elsewhere on Cody.

Given an input matrix, return a matrix with all elements above and to the right of the main diagonal set to zero. Example:

input = [ 1 1 1 1; 1 1 1 1; 1 1 1 1; 1 1 1 1]
output = [1 0 0 0; 1 1 0 0; 1 1 1 0; 1 1 1 1]

Solution Stats

2069 Solutions

1118 Solvers

Last Solution submitted on Feb 14, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers1118

Suggested Problems

More from this Author39

Community Treasure Hunt

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

Start Hunting!