filtmen.m
Upload User: loeagle
Upload Date: 2013-03-02
Package Size: 1236k
Code Size: 3k
Development Platform:

Matlab

  1. function rarg = filtmen (action);
  2. % menu to choose receive filter
  3. global name;
  4. global Buttons;
  5. global menuwinh;
  6. global buttonh;
  7. global MenuWinPos;
  8. Buttons = 3;
  9. ButtonText1 = 'Matched Filter';
  10. ButtonText2 = 'Butterworth';
  11. ButtonText3 = 'Main Menu';
  12. if nargin < 1                                           % no argument -> init 
  13.   action = 'init';
  14. end;
  15. % -----------------------------------------------------------------
  16. % init
  17. % initialize variables and open window
  18. if strcmp (action, 'init')
  19.   % constants and definitions
  20.    set(0,'Units','pixels');
  21.    scnsize = get(0,'ScreenSize');
  22.   MenuWinPos  = [10 (scnsize(4) - (Buttons*28+50)-40)];  % window position
  23.   filtmen ('openmenuwin');                                % open window
  24. end;
  25. % -----------------------------------------------------------------
  26. % openmenuwin
  27. % open window
  28. if strcmp (action, 'openmenuwin')
  29.  
  30.   menuwinh = figure ('Color', 'white', ...              % open window
  31.     'Position', [MenuWinPos 140 (Buttons*28+50)], ... 
  32.     'Name', 'Tutorial', ...
  33.     'NumberTitle', 'off', ...
  34.     'MenuBar', 'none', ...
  35.     'Resize', 'off', ...
  36.     'UserData', 'filtmen');
  37.   uicontrol (menuwinh, ...
  38.     'Style', 'text', ...
  39.     'Position', [5 (Buttons*28+10) 130 30], ...
  40.     'BackgroundColor', 'white', ...
  41.     'HorizontalAlignment', 'center', ...
  42.     'String', 'Receive Filter:');
  43.   for k = 1:Buttons
  44.     ypos = (Buttons- k) * 28 + 10;
  45.     ButtonTextString = eval (['ButtonText'  num2str(k)]);
  46.     CallBackFunction = ['Button' num2str(k)];
  47.     createbutton = ['buttonh(' num2str(k) ') = uicontrol (menuwinh, ' ...
  48.                         '''Position'', [5 ' num2str(ypos) ' 130 22], ' ...
  49.                          '''String'', ''' ButtonTextString ''', ' ...
  50.                          '''BackgroundColor'', ''white'', ' ...
  51.                          '''CallBack'', ''filtmen (''''' CallBackFunction ''''')'');'];
  52.    eval (createbutton);
  53.   end;
  54.   clear createbutton ypos ButtonTextStr CallBackFunction;
  55. end;
  56. % -----------------------------------------------------------------
  57. % Button1
  58. if strcmp (action, 'Button1')
  59.   delete(menuwinh);
  60.   name=[name,'mf'];
  61.   backmen;
  62.   eval(name);
  63. end;
  64. % -----------------------------------------------------------------
  65. % Button2
  66. if strcmp (action, 'Button2')
  67.   delete(menuwinh);
  68.   name=[name,'bw'];
  69.   backmen;
  70.   eval(name);
  71. end;
  72. % -----------------------------------------------------------------
  73. % Button3
  74. if strcmp (action, 'Button3')
  75.   delete(menuwinh);
  76.   DigModTutorial;
  77. end;