How can I draw a graph using a button?

12 Ansichten (letzte 30 Tage)
studentmatlaber
studentmatlaber am 1 Jun. 2022
Beantwortet: Voss am 1 Jun. 2022
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

Akzeptierte Antwort

Voss
Voss am 1 Jun. 2022
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.

Weitere Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by