Azzera filtri
Azzera filtri

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 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Ameer Hamza
Ameer Hamza il 6 Ott 2020
Check the attached app for the demo.
  4 Commenti
義典 鈴木
義典 鈴木 il 6 Dic 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
義典 鈴木
義典 鈴木 il 6 Dic 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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Specifying Target for Graphics Output in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by