From: crazyk Sounthavong on
Hello, I'm trying to make a audio player similar to winamp and etc using Matlab. I am on my fig right now and need help coding my Load button which allows the user to obtain files, makes matlab read it, and puts the file name in a list box named list.

Right now I have

function load_Callback(hObject, eventdata, handles)
[file path] = uigetfile('*.wav','Select the wav file');
[y f] = wavread(path,file);

but it doesn't seem to be reading the wav file in?
From: Steven Lord on

"crazyk Sounthavong" <soun042564(a)gmail.com> wrote in message
news:hr60d7$ldv$1(a)fred.mathworks.com...
> Hello, I'm trying to make a audio player similar to winamp and etc using
> Matlab. I am on my fig right now and need help coding my Load button which
> allows the user to obtain files, makes matlab read it, and puts the file
> name in a list box named list.
>
> Right now I have
>
> function load_Callback(hObject, eventdata, handles)
> [file path] = uigetfile('*.wav','Select the wav file');
> [y f] = wavread(path,file);

Read the help for WAVREAD. Does it have a syntax that accepts two inputs
where those inputs are the path to the file and the file name? No, it
doesn't. Use FULLFILE to combine the two.

> but it doesn't seem to be reading the wav file in?

If that's all the code in your load_Callback, then the WAVREAD call reads in
the specified data (with the change I mentioned above) into variables y and
f ... which are promptly destroyed (along with the rest of the callback
function's workspace) when the callback function exits.

Take a look at the following pages from the documentation for a description
of some of the techniques you can use to share data between callback
functions.

http://www.mathworks.com/access/helpdesk/help/techdoc/creating_guis/f5-998197.html

http://www.mathworks.com/access/helpdesk/help/techdoc/creating_guis/f13-998352.html

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ