How to create a variable and automatic graph using App Designer
Show older comments
Hello all!
I am doing a app which generate a graphic from a certain file.
And I want to create a multiple graph using multiple checkboxes, as below.

So for example, I need to create an automatic graphic depending on the checkboxes cointained in the 'Y Axis' panel, and I am doing this using If statements, as below.
if(app.CurrentACheckBox.Value == 1 && app.VoltageVCheckBox.Value == 0 && app.TemperatureCCheckBox.Value == 0 && app.AhAccuAhCheckBox.Value == 0 && app.AhAccuAhCheckBox.Value == 0 && app.WhAccuWhCheckBox.Value == 0 && app.WhStepWhStepCheckBox.Value == 0)
plot(XAxis,Current)
ylabel('Current [A]')
elseif(app.CurrentACheckBox.Value == 0 && app.VoltageVCheckBox.Value == 1 && app.TemperatureCCheckBox.Value == 0 && app.AhAccuAhCheckBox.Value == 0 && app.AhAccuAhCheckBox.Value == 0 && app.WhAccuWhCheckBox.Value == 0 && app.WhStepWhStepCheckBox.Value == 0)
plot(XAxis,Voltage)
ylabel('Voltage [V]')
elseif(app.CurrentACheckBox.Value == 0 && app.VoltageVCheckBox.Value == 0 && app.TemperatureCCheckBox.Value == 1 && app.AhAccuAhCheckBox.Value == 0 && app.AhAccuAhCheckBox.Value == 0 && app.WhAccuWhCheckBox.Value == 0 && app.WhStepWhStepCheckBox.Value == 0)
plot(Axis,T_Bat_1)
.
.
.
.
Is there a better and elegant way to do this?
Considering that I need to plot multiple variables on the Y axis.
Thank you in advance
Answers (1)
Image Analyst
on 26 Nov 2019
0 votes
Why not use radio buttons, where only one at a time can be set, rather than a bunch of checkboxes?
2 Comments
Gustavo Cervera
on 26 Nov 2019
Image Analyst
on 26 Nov 2019
Well then if there can be any possible combination of checkboxes checked, and they each have a different set of operations you want to do, then I think you'll have to do it like that. You'll have 2^7 = 128 different cases to check for.
Categories
Find more on Spline Postprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!