dbdb Posted December 5, 2007 Share Posted December 5, 2007 (edited) Hi, I'm trying to load data from a MAT file into my M file when creating a GUI. Is there a way to access the variable names and print them on the screen?? I've used 'load('filename', 'X', 'Y', 'Z')' command but you seem to need to know the actual variable name. The code is: -------------------------------------------------------------------------------------------------------------- function OpenFile_Callback(hObject, eventdata, handles) global X Y Z A B C Q l Leds_1_6 Time MetrisFileInfo [newfile,newpath]=uigetfile('*.mat','Open File...') fid=[newpath,newfile]; load(fid) l=length(Leds_1_6) %************************************************************ %* PLOT function Plot_Callback(hObject, eventdata, handles) global X Y Z A B C l Leds_1_6 Time MetrisFileInfo if get(handles.X,'Value') plot(Leds_1_6(1,2:l)) title('Plot of X Values'); --------------------------------------------------------------------------------- The variables of the MAT file being Leds_1_6, Time and MetrisFileInfo. The class of the variables is double, double and char respectively. I want to be able to open other MAT files which will have different variable names.. Any ideas?? Thanks! Edited December 5, 2007 by dbdb Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now