How to create a variable and automatic graph using App Designer

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

답변 (1개)

Image Analyst
Image Analyst 2019년 11월 26일

0 개 추천

Why not use radio buttons, where only one at a time can be set, rather than a bunch of checkboxes?

댓글 수: 2

Because I need to create a graph with multiple choices.
For example, I need to create an automatic graphic with every combination of the checkboxes above.
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.

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

카테고리

도움말 센터File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기

태그

질문:

2019년 11월 26일

댓글:

2019년 11월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by