# How to make Triu in reverse axis for triangular matrices ?

9 visualizaciones (últimos 30 días)
Ramesh Bala el 2 de Dic. de 2020
Comentada: Ramesh Bala el 2 de Dic. de 2020
The function triu makes the upper triangular matrix in the shape of L . How shall I reverse it like to make it run in opposite diirection.
The below function make triu in the top to bottom,i wanna to make it bottom to top and thus reversing it ?
A = ones(6);
idx = ( A(:,3:end) );
A(:,3:end) = triu(idx,-1)
##### 0 comentariosMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos

Iniciar sesión para comentar.

John D'Errico el 2 de Dic. de 2020
Are you asking to do no more than this?
A = magic(6)
A = 6×6
35 1 6 26 19 24 3 32 7 21 23 25 31 9 2 22 27 20 8 28 33 17 10 15 30 5 34 12 14 16 4 36 29 13 18 11
A = flip(tril(flip(A)))
A = 6×6
35 1 6 26 19 24 3 32 7 21 23 0 31 9 2 22 0 0 8 28 33 0 0 0 30 5 0 0 0 0 4 0 0 0 0 0
That is a simple way to do it. There would be others.
##### 1 comentarioMostrar NingunoOcultar Ninguno
Ramesh Bala el 2 de Dic. de 2020
THis is what I was looking for and it worked :)

Iniciar sesión para comentar.

### Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by