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

조회 수: 4 (최근 30일)
cyril
cyril 2014년 5월 31일
편집: cyril 2014년 5월 31일
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에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by