MATLAB Answers

Running script from App designer, workspace not updated

62 views (last 30 days)
I am trying to run a script from App designer. This script defines variables based on files in a folder., the files are timeseries and it can vary how many files which are in the folder. When I run this script from the command window, all the variables are found in the Workspace afterwards. This is not the case when running it from the App designer. In the application there are other scripts depending on the variables from this script, hence if the variables exsisted in the workspace this would be an advantage. Due to the variation in the folder, I think it would be unwise to make a fixed number of outputs and converting the script into a function. Please let me know if you have any tips or ideas how I can make this work.
Thank you very much in advance.
Erik Vabo Vatsvaag
Erik Vabo Vatsvaag on 18 Jan 2021
Thanks, I do could not agree more. Again, I was given the scripts and did recommend to rewrite them as functions.

Sign in to comment.

Accepted Answer

Daniel Catton
Daniel Catton on 13 Jan 2021
If you are trying to view these just so you know they are being shows correctly, then you can enter debugging mode (very similar to debugging in a livescript) by clicking the '-' (on the left hand side of the code view) next to the line number directly after the line of code you are querying. This pauses the app code and all variables within the current function are displayed in the workspace.
If you are wanting to use these variables within Matlab (not App designer), then you can use the following at the top of the function within the app which contains what you want:
global ThingYouWant
% Replace 'ThingYouWant' with whatever variable you need to display.
Then you simply go to your command window, type exactly what you put in the app and the variable should show up in the workspace.
Let me know of any problems and I'll try my best to help.
Erik Vabo Vatsvaag
Erik Vabo Vatsvaag on 19 Jan 2021
Thank you, rewriting all the scripts into functions and passing a struct between them.

Sign in to comment.

More Answers (0)




Community Treasure Hunt

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

Start Hunting!