Filter löschen
Filter löschen

How to control a plot with checkbox in app designer. So when checkbox is tick it may plot graph and when checkbox is unchecked it should remove graph in UIAxes.

16 Ansichten (letzte 30 Tage)
i m plotting a graph in app designer on UIAxes
a = [1 2 3] % added to property
b = [4 5 6] % added to property
in checkbox call back in write following code
Value = app.checkbox.Value
Value = plot(app.UIAxes,a,b)
now when i run the code and tick the checkbox it successfully plots the graph on UIAxes but when i uncheck it Graph doesnt disappear it remains plotted. kindy guide. Thanks

Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 6 Okt. 2020
Check the attached app for the demo.
  4 Kommentare
義典 鈴木
義典 鈴木 am 6 Dez. 2021
Hi. I have a question here. What if I want to create an app like this but I have two separates data. I want my app to be able to plot the first graph of the first data, second graph of the second data and lastly be able to plot both of the data simulataneously. Thank you
義典 鈴木
義典 鈴木 am 6 Dez. 2021
I tried to make it like this but it did not work out
properties (Access = private)
a = [1 2 3] % x position
b = [4 5 6] % y position
p % line object
x = [7 8 9]
y = [1 2 3]
s
end
app.p = plot(app.UIAxes, app.a, app.b);
app.p.Visible = 'off';
app.s = plot(app.UIAxes, app.x, app.y);
app.s.Visible = 'off';
value = app.ShowCheckBox.Value;
value2 = app.Show2CheckBox.Value;
if value == 1
app.p.Visible = 'on';
app.s.Visible = 'off';
elseif value2 == 1
app.s.Visible = 'on';
app.p.Visible = 'off';
elseif value == 1 && value2== 1
app.p.Visible = 'on';
app.s.Visible = 'on';
else
app.p.Visible = 'off';
app.s.Visible = 'off';
end

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Specifying Target for Graphics Output 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