フィルターのクリア

How to toggle between two conditions on app designer

3 ビュー (過去 30 日間)
Anon
Anon 2020 年 12 月 21 日
編集済み: Mario Malic 2020 年 12 月 21 日
I am doing a project on app designer where i need to construct a simulation for projectile motion with user given values. the second part is to include an obstacle as chosen by the user to intersept the projectile. the construction of the obstacle is not a problem however, how would i go about toggling betweeen the two conditions of obstacle ON and obstacle OFF currently the switch code i have is:
switch(app.ObstacleONButton.Text)
case 'Obstacle ON' %toggles the obstacle conditon (removes the option for the obstacle conditions if not selected)
app.ObstacleONButton.Text = 'Obstacle OFF';
app.ObstacleheightEditField.Visible = 'off';
app.DistancetothewallobstaclefromlaunchEditField.Visible = 'off';
case 'Obstacle OFF'
app.ObstacleONButton.Text = 'Obstacle ON';
app.ObstacleheightEditField.Visible = 'on';
app.DistancetothewallobstaclefromlaunchEditField.Visible = 'on';
end
do i need to include a for loop?
thank you v much :3

回答 (1 件)

Mario Malic
Mario Malic 2020 年 12 月 21 日
編集済み: Mario Malic 2020 年 12 月 21 日
Hello,
Use ButtonGroup for this. If you select one, it will deselect the other one(s). You can check the property SelectedObject to get the active button.

カテゴリ

Help Center および File ExchangeElectrical Block Libraries についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by