Programming a digital signal creator using matlab GUI

Discussion in 'Programmer's Corner' started by Eli, Mar 18, 2007.

  1. Eli

    Thread Starter New Member

    Mar 18, 2007
    3
    0
    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
     
  2. Eli

    Thread Starter New Member

    Mar 18, 2007
    3
    0
    If this is too much, too fast, or you look at my post and think, 'this guy has a lot to learn...' :-D then you are probably correct, and if anyone could point me to somewhere I could better learn about the programming aspect of GUI's, including about callbacks, handles, hObjects, functions, etc. as well as how to format them and where to place them exactly in the m-file, then this would also be very helpful. I find the Matlab documentation difficult to understand and more importantly it seems to lack what I consider to be integral information.
    Cheers,
    Eli
     
  3. Dave

    Retired Moderator

    Nov 17, 2003
    6,960
    144
    The best information I have come across for learning to use GUIs in Matlab is through the Matlab documentation - "Creating Graphical User Interfaces". I know its a chore working through it, but I certainly recommend investing some time in reading it.

    The only other information that I have come across that may be of use is http://www.ece.gatech.edu/research/DSP/courses/ee2200/matlab/5.graphics/uiguide.html

    You could also have a look through my Useful Matlab Infomation thread which may help you.

    Dave
     
  4. Eli

    Thread Starter New Member

    Mar 18, 2007
    3
    0
    Haha, ok, I guess I should have figured that'd be my answer. I'll work through the documentation again, and try to figure it out. Thanks!
     
  5. Dave

    Retired Moderator

    Nov 17, 2003
    6,960
    144
    If you have any specific questions about the documentation, feel free to post back - it is easier to give specific help, rather than trying to give a "catch-all" tutorial on a broad topic.

    Dave
     
Loading...