Problem 413. Back to basics 23 - Triangular matrix
Solution Stats
Problem Comments
-
3 Comments
Chad Gilbert
on 11 Jul 2013
Your test suite doesn't really match the problem statement. The tests require matrices with *exactly* all elements abot the main diagonal to be 0 *and* all elements on or below the main diagonal to be 1.
goc3
on 24 Feb 2017
Additional test cases have been added.
Diogo Carvalho
on 10 Feb 2019
Running this on octave returns the correct results yet the page still says I'm wrong.
function y = triangMatrix(x)
for i=1:rows(x);
for j=1:columns(x);
if j>i;
x(i,j)=0;
else
endif
endfor
endfor
disp(x)
endfunction
Solution Comments
Show commentsProblem Recent Solvers939
Suggested Problems
-
3867 Solvers
-
2069 Solvers
-
Number of 1s in a binary string
7267 Solvers
-
11711 Solvers
-
Back to basics - mean of corner elements of a matrix
380 Solvers
More from this Author39
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!