App Designer - Acccess Data in Workspace?

36 Ansichten (letzte 30 Tage)
Erkan Kaymak
Erkan Kaymak am 20 Aug. 2021
Kommentiert: Stephen23 am 21 Aug. 2021
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 Kommentar
Stephen23
Stephen23 am 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?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Image Analyst
Image Analyst am 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')

Weitere Antworten (0)

Kategorien

Mehr zu Data Import and Analysis finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by