Hi everyone! Can somebody help me to write a code to return a matrix with the following form: [1 1 1 1 1;1 1 1 1 0;1 1 1 0 0;1 1 0 0 0;1 0 0 0 0]? it's 5x5 square matrix Thanks in advance

 Akzeptierte Antwort

John D'Errico
John D'Errico am 20 Nov. 2017

0 Stimmen

flip(tril(ones(5)))
ans =
1 1 1 1 1
1 1 1 1 0
1 1 1 0 0
1 1 0 0 0
1 0 0 0 0

Weitere Antworten (0)

Kategorien

Gefragt:

am 20 Nov. 2017

Kommentiert:

am 20 Nov. 2017

Community Treasure Hunt

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

Start Hunting!

Translated by