Clear Filters
Clear Filters

Appdesigner: Loading values into the standard Matlab Workspace and utilsing them

1 view (last 30 days)
I have a piece of m code that works nicely from Matlab - it loads a long list of parameters into the workspace, performs some calculations and then produces some helpful plots.
But when I try to run the same m code from within Appdesigner, none of my parameters are loaded into the Matlab Workspace, even though the code is unchanged in any way.
Can one of you wonderful people offer any suggestions, please ? Thank you in anticipation of your helpful reply.

Accepted Answer

Ameer Hamza
Ameer Hamza on 21 May 2018
Edited: Ameer Hamza on 21 May 2018
If you load the data into the App, it will not appear in the MATLAB base workspace. MATLAB functions or app functions have their own workspaces. So the data loaded inside the function will not be visible in the workspace window unless you are in debugging mode. To correctly load the data and share it in app callback functions you need to do the following.
1) Load the data inside the startUpFcn of the app as shown here. In other words, paste your script inside this function. This function executes everytime you start the app.
2) Then to share the data between app callback functions, refer here. You can create properties, assign the loaded data to these properties in startUpFcn and then other callbacks functions inside your app can access the data using the properties.

More Answers (0)

Categories

Find more on Develop Apps Using App Designer 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!