Global variables in Matlab app
Show older comments
Hi,
How to specify global variables in Matlab app?
I need to access both symbolic and numeric variables across funtions within a Matlab app. So, I thought of creating global variables. I created a startup function and declared my global variables in there. But for some reason they are not global and are not accessible outside of my startup function.
Thanks in advance for the suggestions.
Thanks,
Abinav.
3 Comments
Rik
on 18 Oct 2020
Why do you want to use global variables? Why are the other strategies of sharing data between functions not working?
Abinav
on 18 Oct 2020
Walter Roberson
on 18 Oct 2020
Create a property to store the value.
Answers (1)
Pratheek Punchathody
on 21 Oct 2020
0 votes
For transferring data between one callbacks function to another, you can use “properties” which can be accessible to all functions and callbacks in an app.
"Public Properties" are accessible both inside and outside the app, whereas private properties are only accessible inside of the app.
Refer to the documentation on Share Data Within App Designer Apps for further details on defining properties.
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!