How can I draw a graph using a button?

10 ビュー (過去 30 日間)
studentmatlaber
studentmatlaber 2022 年 6 月 1 日
回答済み: Voss 2022 年 6 月 1 日
Hello everyone, I want to draw a graph when I press the button, but a new plot is created. I want to plot the axeste next to the button. How can I do it?
% Button pushed function: Button
function ButtonPushed(app, event)
X=1:5;
Y=1:5;
plot(X,Y)
end
end

採用された回答

Voss
Voss 2022 年 6 月 1 日
You need to tell the plot function to plot into your axes:
plot(app.UIAxes,X,Y)
If your axes is called something besides app.UIAxes, use that name instead.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpecifying 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