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

8 次查看(过去 30 天)
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)

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by