To avoid global variables, which is the best way to share variables among functions in a GUI in Matlab:
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
1: Using setappdata/getappdata
2: Populating a structure other than 'handles' and then passing this structure as an argument to the functions
3: Populating 'handles' with multiple parameters and using it wherever required
4: Others ?
Is there a limit to the extent 'handles' can be populated with user data in a gui in matlab, ie is it advisable to keep populating the same structure(handles or user-defined) with any number of parameters
0 commentaires
Réponses (1)
Stephen23
le 20 Fév 2018
Modifié(e) : Stephen23
le 20 Fév 2018
I recommend using nested functions: simple, intuitive, easy to debug. See my FEX submission iregexp for an example of this:
Note how it combines nested functions, local functions, several callbacks, and no globals anywhere!
0 commentaires
Voir également
Catégories
En savoir plus sur Workspace Variables and MAT-Files dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!