App Designer: plot on Axes out of function

조회 수: 4 (최근 30일)
Dominik Müller
Dominik Müller 2020년 10월 7일
댓글: Dominik Müller 2020년 10월 8일
Hi everyone,
I created a GUI in App Designer with an Axes-Object on it. Now I want to enter some values via different buutons/slider etc., calculate some stuff and then plot my results on this Axes-Object.
I made a function as m-file which I call to draw/plot all the stuff I want. This is how I call the function:
drawFunction(Data, app.Axes);
In drawFunction I call
function drawFunction(Data, Axes)
axes(Axes)
... % plot stuff
But all the plots I call are drawn to a new figure which opens and not to my Axes on the GUI. Where is my mistake?
  댓글 수: 1
Mohammad Sami
Mohammad Sami 2020년 10월 7일
Maybe its the line
axes(Axes).
You can directly specify the axes to plot in most plotting functions as the first argument.
plot(Axes,1:10,1:10);

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

채택된 답변

Mario Malic
Mario Malic 2020년 10월 7일
편집: Mario Malic 2020년 10월 7일
In App Designer, those are uiaxes.
In the plot function, you can specify axes to plot to
plot(Axes, 1, 1, 'kd')
  댓글 수: 6
Mario Malic
Mario Malic 2020년 10월 8일
편집: Mario Malic 2020년 10월 8일
I doubt so, gca does not accept uiaxes, you can replace your 'plot(' by 'plot(ax,' by using Find option (Ctrl+F).
This is worth of a question (if it's not asked already), so maybe someone else will have an idea how to do it.
Dominik Müller
Dominik Müller 2020년 10월 8일
I started a new question on it.
https://www.mathworks.com/matlabcentral/answers/608241-set-uiaxes-in-matlab-function-as-current-figure-to-plot-on

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

추가 답변 (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