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.

조회 수: 12 (최근 30일)
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

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 10월 6일
Check the attached app for the demo.
  댓글 수: 4
義典 鈴木
義典 鈴木 2021년 12월 6일
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
義典 鈴木
義典 鈴木 2021년 12월 6일
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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Specifying 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