Plotting lower half of matrix

조회 수: 8 (최근 30일)
Jonathan
Jonathan 2011년 10월 28일
Hi,
I have a matrix with values ONLY in the lower half (not even on diagonal). Everything else is zero.
I want to plot just this lower half using imagesc. Problem is there are values of zero in this lower half.
Is there a way around this? I tried tril
Thanks, S
  댓글 수: 1
Naz
Naz 2011년 10월 29일
So, what's the problem with zeros? Imagesc should take pretty much all values.

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

답변 (1개)

Amith Kamath
Amith Kamath 2011년 10월 29일
%I tried this:
X = rand(10,10); %My random pixel data for an image. imagesc(X); %Handles correctly.
L = tril(X); %To get the lower triangular part.
M = L.*(L > 0.5); % To introduce some artificial zeros into the lower triangular part.
imagesc(M); %This seems to display a good image too!
%Hope this helps!

카테고리

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