How can I get elegantly an upper triangle random matrix (0 elsewhere)?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
cyril
el 31 de Mayo de 2014
I have seen the triu and tril functions, but I can't use them to set to 0:
A = rand(4);
tril(A)=0; % won't work
any idea, other than using 2 for loops?
0 comentarios
Respuesta aceptada
Andrei Bobrov
el 31 de Mayo de 2014
Editada: Andrei Bobrov
el 31 de Mayo de 2014
triu(A,1)
1 comentario
Más respuestas (0)
Ver también
Categorías
Más información sobre Operating on Diagonal Matrices 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!