MATLAB Answers

I Made

Combine Wavread and Browse Filepath Using Gui ?

Asked by I Made
on 28 Mar 2013

I'm trying to apply wavread function, but i want a dynamic input from user so i use two button 1 contains the wavread function, 1 contain the browse filepath function.

    function pushbutton1_Callback(hObject, eventdata, handles)
    Filename= get(handles.pushbutton2,'UserData');
    function pushbutton2_Callback(hObject, eventdata, handles)
    [FileName,PathName] = uigetfile('*.wav','Select Audio File ');
    myAudio = get(hObject,'String');
    set(hObject,'UserData',myAudio );

I got error like : Cannot open file.

Can someone correct me please, am i deliver the wrong variable so it can't be opened?Sorry i'm new to GUI so made a noob error.



No products are associated with this question.

1 Answer

Answer by Jing
on 28 Mar 2013
 Accepted answer

You're not include the full path to the file. You should store the full path instead of just the file name.

myAudio=fullfile(PathName, FileName);


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!