フィルターのクリア

App designer hide/show line graph on axes

12 ビュー (過去 30 日間)
Matt
Matt 2023 年 4 月 22 日
コメント済み: Rik 2023 年 4 月 25 日
Hi,
For the life of me I cannot hide/show a graph on my axes when I click a checkbox. I've tried something like:
set(app.graph1, 'visible', 'off');
But of course this hides the axes not the data and I want the other way around. I've tried the following:
set(app.graph1.Children, 'visible', 'off');
This hides the axes content but I just want to hide a specific set of data on the axes. For example I had:
A=plot(app.graph1, time2, speed2, '--m');
hold(app.graph1, 'on');
B=plot(app.graph1, time2, power2, '--b');
So really I just want to hide for example B but keep A.
Thanks!

回答 (1 件)

Rik
Rik 2023 年 4 月 22 日
移動済み: Matt J 2023 年 4 月 22 日
And set(B, 'visible', 'off');?
  2 件のコメント
Matt
Matt 2023 年 4 月 25 日
編集済み: Matt 2023 年 4 月 25 日
It doesn't work. Here is the code:
function Dataset1CheckBoxValueChanged(app, event)
value1=app.Dataset1CheckBox.Value;
A=[];
if value1==1
set(A, 'visible', 'on');
set(app.graph1, 'visible', 'on');
app.dataset1=evalin('base', 'dataset1');
time1=app.dataset1(:,5);
power1=app.dataset1(:,10);
power2=app.dataset1(:,13);
A=plot(app.graph1, time1, power1, 'm');
hold(app.graph1, 'on');
B=plot(app.graph1, time1, power2, 'b');
else
set(A, 'visible', 'off');
end
end
Rik
Rik 2023 年 4 月 25 日
You need to store A and B in the properties. How is Matlab supposed to know what you mean with []?

サインインしてコメントする。

カテゴリ

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