Hi,
I am new to matlab programming so please bear with me. I have saved mat files that I would like to load within a gui. I first need to write a function for these files so I can then write a callback for a push button within my gui.
I am currently testing out writing the function as
fileName = 'whatever'
var1 = xxx
var2 = yyy (*note the reason for labeling my variables is that within the mat file I only want to show values "xxx" and "yyy" all other variables within the mat file are not needed)
s = load('whatever', 'var1', 'var2');
when I "evaluate selection" It displays what I want in the command window except there is an error using load
"Unable to read file fileName: No such file or directory."
what did I do wrong?
Thanks so much for any help
|
|
0
|
|
|
|
Reply
|
Lanelle
|
10/4/2010 3:53:04 PM |
|
> fileName = 'whatever'
> s = load('whatever', 'var1', 'var2');
> "Unable to read file fileName: No such file or directory."
Is 'whatever' the full path?
I guess the GUI's folder is an other than the folder the variables are stored to.
Try using the full path.
Any other problems or wishes?
|
|
0
|
|
|
|
Reply
|
Janis
|
10/7/2010 11:45:05 AM
|
|
"Janis Doebler" <janis.doebler@tu-berlin.de> wrote in message <i8kbs1$843$1@fred.mathworks.com>...
> > fileName = 'whatever'
> > s = load('whatever', 'var1', 'var2');
> > "Unable to read file fileName: No such file or directory."
>
> Is 'whatever' the full path?
> I guess the GUI's folder is an other than the folder the variables are stored to.
> Try using the full path.
>
> Any other problems or wishes?
Thank you for replying. I actually did solve the issue using
fileName = 'whatever.mat'
load('whatever','xxx','yyy')
whos('-file','whatever.mat')
var1 = xxx
var2 = yyy
s = whos(fileName,'var1','var2');
My next issue is writing a function for this in order to load the specific values when I open my .mat file using uigetfile
Right now in a test gui I for my pushbutton callback, I have:
handles.fileName = uigetfile('*.mat')
guidata(hObject, handles)
setPopupmenuString(handles.popupmenuCalc, eventdata, handles)
function setPopupmenuString(hObject, eventdata, handles)
fileName = handles.fileName
what do I need to add to this code for my callback to display my mat files in the form above.
|
|
0
|
|
|
|
Reply
|
Lanelle
|
10/7/2010 3:28:04 PM
|
|
"Lanelle " <woodey@umd.edu> wrote in message <i8kou4$j9v$1@fred.mathworks.com>...
> "Janis Doebler" <janis.doebler@tu-berlin.de> wrote in message <i8kbs1$843$1@fred.mathworks.com>...
> > > fileName = 'whatever'
> > > s = load('whatever', 'var1', 'var2');
> > > "Unable to read file fileName: No such file or directory."
> >
> > Is 'whatever' the full path?
> > I guess the GUI's folder is an other than the folder the variables are stored to.
> > Try using the full path.
> >
> > Any other problems or wishes?
>
> Thank you for replying. I actually did solve the issue using
> fileName = 'whatever.mat'
> load('whatever','xxx','yyy')
> whos('-file','whatever.mat')
> var1 = xxx
> var2 = yyy
>
> s = whos(fileName,'var1','var2');
> My next issue is writing a function for this in order to load the specific values when I open my .mat file using uigetfile
>
> Right now in a test gui I for my pushbutton callback, I have:
>
> handles.fileName = uigetfile('*.mat')
> guidata(hObject, handles)
> setPopupmenuString(handles.popupmenuCalc, eventdata, handles)
>
> function setPopupmenuString(hObject, eventdata, handles)
> fileName = handles.fileName
>
> what do I need to add to this code for my callback to display my mat files in the form above.
|
|
0
|
|
|
|
Reply
|
woodey (12)
|
10/8/2010 4:29:07 PM
|
|
|
3 Replies
307 Views
(page loaded in 0.074 seconds)
Similiar Articles: writing a function to load mat files and then writing a callback ...Hi, I am new to matlab programming so please bear with me. I have saved mat files that I would like to load within a gui. I first need to write a fun... How to read/write .mat files in VB.net... - comp.soft-sys.matlab ...writing a function to load mat files and then writing a callback ... How to read/write .mat files in VB.net... - comp.soft-sys.matlab ... how to write *.cnf file? - comp ... Passing variables between GUI calback functions - comp.soft-sys ...writing a function to load mat files and then writing a callback ... I guess the GUI's folder is an other than the folder the variables are ... passing a FH to a module ... error writing to new file - comp.emacswriting a function to load mat files and then writing a callback ... Hi, I am new to ... How to read/write .mat files in VB.net... - comp.soft-sys.matlab ... how to write ... Reading a directory and selecting only desired filenames - comp ...writing a function to load mat files and then writing a callback ..... var1', 'var2'); when I "evaluate selection ... var1', 'var2'); > > "Unable to read file fileName ... Read Excel with Object Rexx - comp.lang.rexxwriting a function to load mat files and then writing a callback ..... load('whatever', 'var1', 'var2'); > "Unable to read ... so you can do > mycsvwrite(mat ... save ... Wrap a function - comp.lang.pythonwriting a function to load mat files and then writing a callback ... Read the documentation ... you should wrap it up in a function, so you can do > mycsvwrite(mat ... Writing a matrix with header into a CSV/XLS file - comp.soft-sys ....... and you should wrap it up in a function, so you can do > mycsvwrite(mat ... file into array - comp.unix.shell how to write ... the heading row to the matrix and then writing ... Load csv file into MATLAB workspace on a Mac - comp.soft-sys ...Writing a matrix with ... an excel file ... load all_mat_files ... This MATLAB function loads the variables from a MAT-file into a structure array, or data ... load -Load ... IDL routine to read MATLAB MAT-files - comp.lang.idl-pvwave ...... an IDL routine to read MATLAB MAT-files. I ... _dir END --- Also, the load_mat routine only works for MAT-files ... data (file.dat or file.xls) and then create a mat ... writing a function to load mat files and then writing a callback ...Hi, I am new to matlab programming so please bear with me. I have saved mat files that I would like to load within a gui. I first need to write a fun... writing a function to load mat files and then w... - Newsreader ...Thread Subject: writing a function to load mat files and then writing a callback for it 7/21/2012 11:40:47 PM
|