How can I organize app class properties like structs?

1 vue (au cours des 30 derniers jours)
Radu Andrei Matei
Radu Andrei Matei le 3 Mai 2022
Modifié(e) : Matt J le 3 Mai 2022
Hi, I'm creating an app based on functions that I programmed outside of app designer. These functions organize all the variables into structs. I make the app ask for the values of some of these variables as input data which I then want the app to transfer to my external functions to make calculations. The problem is that I have hundreds of variables. Naive me wanted to create properties with similar names to the structs from my functions and then just call the external functions, compute the results, save them in structs and say that app.Struct = struct for each struct, but of course that didn't work. Is there a way for me to group variables into something similar as structs so that I don't have to create hundreds of properties, one for each variable?
And if this question doesn't make much sense, my broader problem is how to use external functions in the app designer code. I just want my app to ask for values and input those into my external functions to obtain results so that I can display those results in the app again but those data transfer processes, from app to functions and back, yeah, I don't understand how to manage them so if someone can forward me to documentation or useful info it'd be greatly appreciated.
  1 commentaire
Stephen23
Stephen23 le 3 Mai 2022
How about nesting those structures into one structure?

Connectez-vous pour commenter.

Réponses (1)

Matt J
Matt J le 3 Mai 2022
Modifié(e) : Matt J le 3 Mai 2022
The problem is that I have hundreds of variables.
Assuming they are scalar, they should be bundled together in a vector, not a struct. That's what vectors are for.
my broader problem is how to use external functions in the app designer code
Not sure what "external" means here. Any function you can call from the command line, or from within a Matlab script or function, can be called from within an app callback function in precisely the same way.

Catégories

En savoir plus sur Develop Apps Using App Designer 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!

Translated by