How can I organize app class properties like structs?

1 visualizzazione (ultimi 30 giorni)
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.

Risposte (1)

Matt J
Matt J il 3 Mag 2022
Modificato: Matt J il 3 Mag 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.

Categorie

Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by