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

조회 수: 2 (최근 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;
else
uiwait(msgbox('Audio have been selected','sucess','modal'));
hold off;
x = x (:,1)
N = length(x);
t = (0:N-1)/fs;
N/fs
%plot
plot(t,x)
grid on
xlabel('Time (s)')
ylabel('Ampl')
end
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);
axes5(handles.axes);
plot(hamming);
end
its not showing plot(hamming) after processing in axes why? how can we resolve that error? please guide

답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulation, Tuning, and Visualization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by