Hey all,
I'm working on a matlab GUI that is supposed to be able to create frog calls with a variety of specified parameters. I'm doing ok figuring out the functions for creating the calls themselves, and I built the GUI itself quite easily using GUIDE. The problem I am having is in programming the m-file to include my code for the functions so that the buttons and text edits actually lead somewhere (Similar I believe to Ron7s problem, except I am trying to create a signal). At this point I am simply trying to create a GUI that can make a pure-tone pulse of a specified length with a specified sampling rate, phase shift, pulse length, and frequency. The code I've tried to create (only like 20 lines) to accomplish this is copied in at the end of this message. I find myself somewhat at a loss, so if anyone can point out errors in the way I'm doing my callbacks(im pretty sure there are significant ones), or how my function syntax is incorrect, it would be greatly appreciated.
Thanks in advance!
Eli
function setup
y = sin(x+p);
t=(0,S1,T1);
f=edit4_Callback(hObject, eventdata, handles);
%This edit box specifies frequency on the GUI
T1= edit1_Callback(hObject, eventdata, handles);
%This is the entered length of the pulse from the GUI in milliseconds.
S1=(1/(R/1000));
%This is the number of milliseconds each sample will be, which I think is
%the second parameter in the t function (I may be confused about this.)
p=edit3_Callback(hObject, eventdata, handles);
%This is the entered phase shift on the GUI
R=edit2_Callback(hObject, eventdata, handles);
%This is the entered sampling rate on the GUI in samples per second.
plot(y);
%This is my attempt to plot the waveform I have created.
wavwrite y
%Once I get the rest of this working this should write my function as a wav
%file.
end
I'm working on a matlab GUI that is supposed to be able to create frog calls with a variety of specified parameters. I'm doing ok figuring out the functions for creating the calls themselves, and I built the GUI itself quite easily using GUIDE. The problem I am having is in programming the m-file to include my code for the functions so that the buttons and text edits actually lead somewhere (Similar I believe to Ron7s problem, except I am trying to create a signal). At this point I am simply trying to create a GUI that can make a pure-tone pulse of a specified length with a specified sampling rate, phase shift, pulse length, and frequency. The code I've tried to create (only like 20 lines) to accomplish this is copied in at the end of this message. I find myself somewhat at a loss, so if anyone can point out errors in the way I'm doing my callbacks(im pretty sure there are significant ones), or how my function syntax is incorrect, it would be greatly appreciated.
Thanks in advance!
Eli
function setup
y = sin(x+p);
t=(0,S1,T1);
f=edit4_Callback(hObject, eventdata, handles);
%This edit box specifies frequency on the GUI
T1= edit1_Callback(hObject, eventdata, handles);
%This is the entered length of the pulse from the GUI in milliseconds.
S1=(1/(R/1000));
%This is the number of milliseconds each sample will be, which I think is
%the second parameter in the t function (I may be confused about this.)
p=edit3_Callback(hObject, eventdata, handles);
%This is the entered phase shift on the GUI
R=edit2_Callback(hObject, eventdata, handles);
%This is the entered sampling rate on the GUI in samples per second.
plot(y);
%This is my attempt to plot the waveform I have created.
wavwrite y
%Once I get the rest of this working this should write my function as a wav
%file.
end