How to stop a plot when values get to negative.
조회 수: 10 (최근 30일)
이전 댓글 표시
I have a 10 by 10 matrix say z = rand(10,10), x = linspace(0,1,10) and y = linspace(0,1,10). I am plotting a surface plot: surf(x,t,z) and would like it to stop plotting when z < 0.5. I have used the while loop but but it runs forever. Any alternatives or recommendations? Thank you.
댓글 수: 0
채택된 답변
OCDER
2018년 5월 9일
Set the z-axis limit to stop drawing below or above certain ranges
z = rand(10,10);
x = linspace(0,1,10);
y = linspace(0,1,10);
surf(x,y,z)
Ax = gca;
Ax.ZLim(1) = 0.5;
댓글 수: 0
추가 답변 (1개)
Fangjun Jiang
2018년 5월 9일
one way to do it, not sure if it is right for your use case though,
z(z<0.5)=nan;
surf(x,y,z)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!