How can I get elegantly an upper triangle random matrix (0 elsewhere)?

3 次查看(过去 30 天)
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?

采纳的回答

Andrei Bobrov
Andrei Bobrov 2014-5-31
编辑:Andrei Bobrov 2014-5-31

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Operating on Diagonal Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by