How to access to variables saved in Matlab folder from the GUI
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Ege
am 5 Jan. 2015
Bearbeitet: per isakson
am 6 Jan. 2015
I want to load my dataset or access any other variables that are saved to my matlab folder or are in my workspace currently from the matlab GUI I created. But when I call my functions on callback function of a button, I can't do it. Could you give me a simple example how to do it?
2 Kommentare
per isakson
am 5 Jan. 2015
"any other variables that are saved to my matlab folder"   do you mean saved in a mat-file in the current folder?
See evalin
Akzeptierte Antwort
per isakson
am 5 Jan. 2015
Bearbeitet: per isakson
am 5 Jan. 2015
filename = 'durer.mat';
myVars = {'X','caption'};
S = load(filename,myVars{:})
to the callback function.
 
" or are in my workspace"   see evalin, Execute MATLAB expression in specified workspace and add
my_variable = evalin( 'base', 'my_variable' )
to the callback function.
8 Kommentare
per isakson
am 6 Jan. 2015
Bearbeitet: per isakson
am 6 Jan. 2015
"I can't do anything on it"
- I assume that assignin actually assigned a variable in the base workspace
- load assigns a value to the variable S.  dataset2 is not a variable, but a field of the struct S. Try churn = S.dataset2.churn;.
Comments
- Do a few excercises with Access Data in a Structure Array
- Don't make it a habbit to use globals.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Tables finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!