how to set anti diagonal part of matrix with zero value elements ?

조회 수: 4 (최근 30일)
i know that how to set diagonal part of matrix to zero, for that we have a code m=256; n=256; a=ones(m,n); u=triu(a); imshow(u);
but in case of anti diagonal what will be code?

채택된 답변

Nicolai Sanders
Nicolai Sanders 2017년 3월 8일
I think this might do what you need.
m=256; n=256; a=ones(m,n); u=flip(triu(a)); imshow(u);
Look at the help page for "flip" to see the options.
  댓글 수: 2
ajeet verma
ajeet verma 2017년 3월 9일
thanks for giving me answer but 'flip' is not working instead of this i have tried 'flipud' that give me required result
Walter Roberson
Walter Roberson 2017년 3월 9일
flip was new as of r2013b

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by