App Designer - Acccess Data in Workspace?

36 vues (au cours des 30 derniers jours)
Erkan Kaymak
Erkan Kaymak le 20 Août 2021
Commenté : Stephen23 le 21 Août 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 commentaire
Stephen23
Stephen23 le 21 Août 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?

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 20 Août 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')

Plus de réponses (0)

Catégories

En savoir plus sur Data Import and Analysis dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by