How do I feed a function the name of the app.UIAxes to plot to?

6 ビュー (過去 30 日間)
AThomas
AThomas 2020 年 6 月 21 日
回答済み: Cris LaPierre 2020 年 8 月 1 日
As per the title...
I have written a general function to plot some data.
How do I feed the function the name of the axis to plot to. I am using appdesigner and need some plots on different app.UIAxes

回答 (1 件)

Cris LaPierre
Cris LaPierre 2020 年 8 月 1 日
Are the axes located in the same app?
Is this a callback funtion in the app, a private function, etc? In either scenario, the first input to your function is automatically app. You just need to know the name of the axes, which can be obtained from the Component Browser (top right).
You specify the axes as part of the plot command. Use the syntax plot(ax,___). It might look something like this.
methods (Access = private)
function myFcn(app)
x=0:0.1:4*pi;
y=sin(x);
plot(app.UIAxes2,x,y)
end
end

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by