How to invoke a selection change in a toggle button group if relevant conditions are met in another function?

8 ビュー (過去 30 日間)
eejhun93
eejhun93 2018 年 2 月 24 日
回答済み: Melissa Williams 2018 年 3 月 16 日
I am currently designing an app on Matlab's app designer using Matlab R2017a. I'm looking at 2 toggle button groups (a master and a slave) with 2 buttons (on and off). If I select 'on' on the master group and hence running the master group callback function, I want this callback function to run its code and check if the slave button is on 'off'. If it is 'off', I want the callback function from the master group to change the selection on the slave group to 'on' and run the code in the slave group function. If it is 'on', do nothing. I tried to use app.onButton=true for the slave group when the conditions were met but this only changed the aesthetics of the button group to appear as if it was selected but the slave function itself does not run.
I plan for the master group button callback function to contain a loop so in effect there would be 2 functions running at concurrently.
Are these possible to do and how do I go about doing it?

回答 (1 件)

Melissa Williams
Melissa Williams 2018 年 3 月 16 日
When you set the property of the slave group, you can also manually run it's callback function, something like:
app.onButton.value = true;
SlaveButtonGroupSelectionChanged(app) (replace this with the name of the callback you want to run)

Community Treasure Hunt

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

Start Hunting!

Translated by