Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Is an if statement needed to distinguish between two similar callbacks?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have two push buttons in my GUIDE window. One is for opening files and reformatting them while the other does exactly the same thing but bins the data in half to allow for it to be plotted more quickly. Currently I just have both callbacks in the guide, but because they use exactly the same variable names and handles, I was thinking i may need to install an if statement to say;
If push button 1 is pushed, push button 2 is unused, and vice versa.
My query is, do i need a statement like this or could the code work without it?
3 commentaires
Adam
le 4 Mai 2017
You might as well use a radio button in a button group if the options are truly mutually exclusive.
Then if the user really does want to select the other option you would just throw away everything from the previous one, freeing the memory too.
How to handle this type of behaviour in a GUI is very much down to the usage though - if it is just for you to test some things out then clearly it can be as basic as you want. If you are packaging it up and releasing it as a piece of software for paying clients to use then obviously the standards need to be a lot higher.
Réponses (0)
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!