Effacer les filtres
Effacer les filtres

App designer hide/show line graph on axes

9 vues (au cours des 30 derniers jours)
Matt
Matt le 22 Avr 2023
Commenté : Rik le 25 Avr 2023
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!

Réponses (1)

Rik
Rik le 22 Avr 2023
Déplacé(e) : Matt J le 22 Avr 2023
And set(B, 'visible', 'off');?
  2 commentaires
Matt
Matt le 25 Avr 2023
Modifié(e) : Matt le 25 Avr 2023
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 le 25 Avr 2023
You need to store A and B in the properties. How is Matlab supposed to know what you mean with []?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Specifying Target for Graphics Output dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by