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 件のコメント

Gustavo Cervera
Gustavo Cervera 2019 年 11 月 26 日
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.
Image Analyst
Image Analyst 2019 年 11 月 26 日
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 ExchangeSpline 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