How to create a variable and automatic graph using App Designer
Mostrar comentarios más antiguos
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
Respuestas (1)
Image Analyst
el 26 de Nov. de 2019
0 votos
Why not use radio buttons, where only one at a time can be set, rather than a bunch of checkboxes?
2 comentarios
Gustavo Cervera
el 26 de Nov. de 2019
Image Analyst
el 26 de Nov. de 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.
Categorías
Más información sobre Spline Postprocessing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!