필터 지우기
필터 지우기

axis function in Appdesigner

조회 수: 7 (최근 30일)
William Chambers
William Chambers 2018년 12월 18일
댓글: Arvind Sathyanarayanan 2018년 12월 18일
I'm trying to plot a single cycle of a wave. I've managed to do it in a test script using the axis function and limiting the range that is shown. However when I try to implement it into the app designer, it continues to plot the full wave and plots a second blank graph. My question is, does the axis function work differently when applied to a graph in the appdesigner? I've left some code out but below is what I use to limit the axis in app designer. The same code works in a standard function.
T = 1/modfreq ;
dt = 1/fs;
tt = 0:dt:T+dt ;
plot(app.UIAxes, len, wave)
axis([0 length(tt) 0 1])

채택된 답변

Arvind Sathyanarayanan
Arvind Sathyanarayanan 2018년 12월 18일
The x & y axis limits can be set using the XLim & YLim properties
ax=app.UIAxes;
ax.XLim = [0 length(tt)];
ax.YLim = [0 1];
You could also try:
T = 1/modfreq ;
dt = 1/fs;
tt = 0:dt:T+dt ;
plot(app.UIAxes, len, wave)
axis(app.UIAxes, [0 length(tt) 0 1])
  댓글 수: 2
William Chambers
William Chambers 2018년 12월 18일
Yes!! Thanks so much for this.
Arvind Sathyanarayanan
Arvind Sathyanarayanan 2018년 12월 18일
You're welcome! The best practice is to always specify the axis you want to modify.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by