how to use switches on app designer
39 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I am using Matlab app designer to create a gui for my unit converter. To do this i have decided to use a switch that will allow the user to flip between metric to imperial and imperial to metric. However, when i change the swtich to imperial to metric, the items in the drop box do not change. I have attatched my code, i hope someone can guide me in the right direction. I have tried using if statements to make this happen however it fails to register the changed value of the switch.
Thank you.
0 Commenti
Risposte (1)
Mehmed Saad
il 6 Mag 2020
In line 40 of your code
if strcmpi(conversionvalue, 'temperature') && strcmpi(switchvalue, 'imperial to metric')
the string which is coming from switchvalue is
'imperial to metric '
i.e. 1 space at the end
It is better to give switches values in items data
so now instead of passing the complete string it will pass 0 or 1
if strcmpi(conversionvalue, 'temperature') && (switchvalue==0)
You can also apply similar strategy on conversion type
0 Commenti
Vedere anche
Categorie
Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!