using .mat and .m files in GUI
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Background: I am building a GUI which uses uigetfile to allow user to select .mat file containing data of interest. The .mat file contains some matrices, from which the GUI will select one with a certain name and pass it to a function outside the GUI.
My question: How can I get the GUI to pass the matrix of interest from a .mat file that the user selects to an outside function? I began by finding the handles of the outside function by
functionhandle=@function;
[output]=functionhandle(matrix from .mat file, etc.);
Thanks
0 Kommentare
Antworten (2)
Fangjun Jiang
am 16 Aug. 2011
a=load('datafile.mat');
VarName=fieldnames(a);
will give you all the variable names in datafile.mat. Then, select a variable name and pass the value to your function.
MyVarName=VarName{1};
functionhandle(a.(MyVarName))
0 Kommentare
Siehe auch
Kategorien
Mehr zu Workspace Variables and MAT Files 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!