I'm trying to create a MATLAB app for a code I have written. I have a tspan that is
tspan = [0 0.25 0.5 0.75 1 2 3 4 5 6 7 8 9 10 11 12];
I have set the xticks to these values manually in the app designer. However, when the app solves it starts the corresponding results x-array at a value of 1 - not at the correct starting value of 0. It is essentially plotting it as if my tspan were [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16]. Can anyone help me resolve this?

 채택된 답변

Mario Malic
Mario Malic 2021년 2월 25일

0 개 추천

Hi,
XLim is the property that you need to adjust in the code, or in the component editor.
app.UIAxes.XLim = [0 12];

댓글 수: 3

Andrew Ferguson
Andrew Ferguson 2021년 2월 26일
Hi Mario,
XLim was already set to [0 12] in the component editor. I also, for the sake of it, added it to the code and it didn't change anything.
Mario Malic
Mario Malic 2021년 2월 26일
Is app.UIAxes actually the axes you're plotting on?
Can you show your code with plot command?
No it wasn't that was my problem. I was trying to plot using
plot(app.UIAxes,output)
when I should have been using
plot(app.UIAxes,tspan,output)
Stupid mistake on my part but thanks for the help!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

질문:

2021년 2월 25일

댓글:

2021년 2월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by