suppose there are two buttons in a GUI and from first button i browsed an audio file and now i want to use that audio file in the callback function of second button for further processing on that audio file with second button

1 回表示 (過去 30 日間)
This is code for button 1:
function pushbutton1_Callback(hObject, eventdata, handles)
[filename, pathname] = uigetfile({'*.wav'}, 'Select File');
fullpathname = strcat (pathname, filename);
[x,fs] = audioread(fullpathname);
%check apakah user menekan batal pada dialog
if isequal(filename,0) || isequal(pathname,0)
uiwait(msgbox ('User pressed cancel','failed','modal') )
hold on;
uiwait(msgbox('Audio have been selected','sucess','modal'));
hold off;
x = x (:,1)
N = length(x);
t = (0:N-1)/fs;
grid on
xlabel('Time (s)')
handles.output = hObject;
guidata(hObject, handles);
This is code for button 2:
function pushbutton4_Callback(hObject, eventdata, handles
handles.fullpathname = fullpathname;
if isfield(handles, 'fullpathname')
fullpathname = handles.fullpathname;
sr = 44100; %sampling rate
w = 512; %window size
T = w/sr; %period
t = linspace(0, 1, 44100);
twindow = t(1:512);
hamming = 0.54 - 0.46 * cos((2 * pi * twindow)/T);
its not showing plot(hamming) after processing in axes why? how can we resolve that error? please guide

回答 (0 件)


Help Center および File ExchangeAudio and Video Data についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by