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

14 views (last 30 days)
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?

Answers (1)

Melissa Williams
Melissa Williams on 16 Mar 2018
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)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!