how to use switches on app designer
39 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Mehmed Saad
2020 年 5 月 6 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Develop Apps Using App Designer についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!