App Designer - Acccess Data in Workspace?

39 views (last 30 days)
Hallo,
I have some data in the Workspace which I can access without any problems from the command window. However, if I try to call the variable in a callback function it does not work. It says that it is not recognizing a variable with such a name though the data is in the Workspace already.
How can I access the data which is already in the workspace in the appdesigner callback?
thanks.
regards
Erkan
  1 Comment
Stephen23
Stephen23 on 21 Aug 2021
The neatest, easiest, simplest, and by far the most efficient approach is to pass data as input/output arguments:
The MATLAB documentation clearly describes passing data as input/output arguments as "best practice".
Did you try passing the data as input/output arguments?

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 20 Aug 2021
From the help:
Evaluate Variable Name in Base Workspace
Use the evalin function to get the value of a variable in the MATLAB base workspace and store it in a new variable.
Define var as the 5-by-5 matrix returned by the magic function.
var = magic(5);
Get the value of the variable var in the MATLAB base workspace and store it in the variable v.
v = evalin('base','var')

More Answers (0)

Categories

Find more on Data Import and Analysis in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!