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

8 visualizzazioni (ultimi 30 giorni)
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?

Risposte (1)

Melissa Williams
Melissa Williams il 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)

Categorie

Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by