www.pudn.com > WCDMA.rar > DPCHMenu.m


function fig = DPCHMenu(sam) 
%************************************************************ 
% 
% Copyright 2002 The Mobile and Portable Radio Research Group 
% 
% Part of GUI for downlink simulator. 
% Generates the menu for the other DPCHs and controls the  
% processing and navigation whil in that menu 
% 
%************************************************************ 
 
global NumDPCHcalls DPCHremainder CallNumber LastCallChannelCount 
global DPCHformatHandle1 DPCHformatHandle2 DPCHformatHandle3 DPCHformatHandle4 
 
 
load DPCHMenu 
 
s1 = '|SF |Data bits|TPC bits|TFCI bits|Pilot bits|'; 
s2 = '|512|      4  |    2   |    0    |     4    |'; 
s3 = '|512|      2  |    2   |    2    |     4    |'; 
s4 = '|256|     14  |    2   |    2    |     2    |'; 
s5 = '|256|     14  |    2   |    0    |     4    |'; 
s6 = '|256|     12  |    2   |    2    |     4    |'; 
s7 = '|256|     10  |    2   |    0    |     8    |'; 
s8 = '|256|      8  |    2   |    2    |     8    |'; 
s9 = '|128|     34  |    2   |    0    |     4    |'; 
s10= '|128|     32  |    2   |    2    |     4    |'; 
s11= '|128|     30  |    2   |    0    |     8    |'; 
s12= '|128|     28  |    2   |    2    |     8    |'; 
s13= '| 64|     60  |    4   |    8    |     8    |'; 
s14= '| 32|    140  |    4   |    8    |     8    |'; 
s15= '| 16|    288  |    8   |    8    |    16    |'; 
s16= '|  8|    608  |    8   |    8    |    16    |'; 
s17= '|  4|   1248  |    8   |    8    |    16    |'; 
 
s=strvcat(s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17); 
 
if CallNumber < NumDPCHcalls 
   s21 = sprintf('DPCH #%d',4*(CallNumber-1)+1); 
   s22 = sprintf('DPCH #%d',4*(CallNumber-1)+2); 
   s23 = sprintf('DPCH #%d',4*(CallNumber-1)+3); 
   s24 = sprintf('DPCH #%d',4*(CallNumber-1)+4); 
   EnableString1 = 'on'; 
   EnableString2 = 'on'; 
   EnableString3 = 'on'; 
   EnableString4 = 'on'; 
else 
   if DPCHremainder >= 1 
      s21 =  sprintf('DPCH #%d',4*(CallNumber-1)+1); 
      s22=[]; 
      s23=[]; 
      s24=[]; 
      EnableString1='on'; 
      EnableString2 = 'off'; 
      EnableString3 = 'off'; 
      EnableString4 = 'off'; 
   end 
   if DPCHremainder >= 2 
      s22 =  sprintf('DPCH #%d',4*(CallNumber-1)+2); 
      s23=[]; 
      s24=[]; 
      EnableString2 = 'on'; 
   end 
   if DPCHremainder >= 3 
      s23 =  sprintf('DPCH #%d',4*(CallNumber-1)+3); 
      s24=[]; 
      EnableString3 = 'on'; 
   end 
   if DPCHremainder >= 4 
      s24 =  sprintf('DPCH #%d',4*(CallNumber-1)+4); 
      EnableString4 = 'on'; 
   end 
end 
 
bdwidth = 5; 
topbdwidth=30; 
ScreenSize = get(0,'ScreenSize'); 
Width = 560; 
Height = 420; 
right = round((ScreenSize(3)-Width)/2)-2*bdwidth; 
bottom = ScreenSize(4)-Height-4*topbdwidth; 
 
%Generate Figure 
h0 = figure('Color',[0.8 0.8 0.8], ... 
	'Colormap',mat0, ... 
	'FileName','C:\MATLABR11\work\LGIChannel\DownlinkSimulator\gui\DPCHMenu.m', ... 
	'PaperPosition',[18 180 576 432], ... 
	'PaperUnits','points', ... 
	'Position',[right bottom 560 420], ... 
	'Tag','Fig1', ... 
   'ToolBar','none'); 
 
%Generate Title 
h1 = uicontrol('Parent',h0, ... 
	'Units','points', ... 
	'BackgroundColor',[0.8 0.8 0.8], ... 
	'FontSize',20, ... 
	'ListboxTop',0, ... 
	'Position',[63.75 276 269.25 24], ... 
	'String','WCDMA Downlink Simulator', ... 
	'Style','text', ... 
	'Tag','StaticText1'); 
 
%Generate subtitle 
h1 = uicontrol('Parent',h0, ... 
	'Units','points', ... 
	'BackgroundColor',[ 0.8 0.8 0.8], ... 
	'FontSize',14, ... 
	'ListboxTop',0, ... 
	'Position',[120.75 255 158.25 18.75], ... 
	'String','Remaining DPCHs', ... 
	'Style','text', ... 
	'Tag','StaticText2'); 
% Objects for the First DPCH 
h1 = uicontrol('Parent',h0, ... 
	'Units','points', ... 
	'BackgroundColor',[ 0.8 0.8 0.8], ... 
	'FontSize',10, ... 
	'ListboxTop',0, ... 
	'Position',[33.75 245.5 50 12], ... 
	'String',s21, ... 
	'Style','text', ... 
          'Tag','StaticText3',... 
          'Visible',EnableString1); 
h1 = uicontrol('Parent',h0, ... 
	'Units','points', ... 
	'BackgroundColor',[ 0.8 0.8 0.8], ... 
	'FontName','Courier', ... 
	'FontSize',8, ... 
   	'ListboxTop',0, ... 
   	'HorizontalAlignment','Left',... 
	'Position',[33.75 229.5 300 12], ... 
	'String',s1, ... 
	'Style','text', ... 
	'Tag','StaticText3',... 
          'Visible',EnableString1); 
DPCHformatHandle1 = uicontrol('Parent',h0, ... 
	'Units','points', ... 
	'BackgroundColor',[1 1 1], ... 
	'FontName','Courier', ... 
	'ListboxTop',0, ... 
	'Position',[30.75 207.75 300 20.25], ... 
	'String',s, ... 
	'Style','popupmenu', ... 
          'Tag','DPCH #1 Popup Menu', ... 
          'Value',1,... 
          'Visible',EnableString1,... 
          'Enable',EnableString1); 
 
%Objects for the Second DPCH 
h1 = uicontrol('Parent',h0, ... 
	'Units','points', ... 
	'BackgroundColor',[ 0.8 0.8 0.8], ... 
	'FontSize',10, ... 
	'ListboxTop',0, ... 
	'Position',[33.75 194 50 12], ... 
	'String',s22, ... 
	'Style','text', ... 
   	'Tag','StaticText3',... 
          'Visible',EnableString2); 
h1 = uicontrol('Parent',h0, ... 
	'Units','points', ... 
	'BackgroundColor',[ 0.8 0.8 0.8], ... 
	'FontName','Courier', ... 
	'FontSize',8, ... 
	'ListboxTop',0, ... 
   	'HorizontalAlignment','Left',... 
	'Position',[33.75 178.25 300 12], ... 
	'String',s1, ... 
	'Style','text', ... 
	'Tag','StaticText3',... 
          'Visible',EnableString2); 
DPCHformatHandle2 = uicontrol('Parent',h0, ... 
	'Units','points', ... 
	'BackgroundColor',[1 1 1], ... 
	'FontName','Courier', ... 
	'ListboxTop',0, ... 
	'Position',[29.25 156.5 300 20.25], ... 
	'String',s, ... 
	'Style','popupmenu', ... 
	'Tag','DPCH #2 Popup Menu', ... 
	'Value',1,... 
          'Visible',EnableString2,... 
          'Enable',EnableString2); 
 
%Objects for the third DPCH 
h1 = uicontrol('Parent',h0, ... 
	'Units','points', ... 
	'BackgroundColor',[ 0.8 0.8 0.8], ... 
	'FontSize',10, ... 
	'ListboxTop',0, ... 
	'Position',[33.75 143 50 12], ... 
	'String',s23, ... 
	'Style','text', ... 
   	'Tag','StaticText3',... 
          'Visible',EnableString3); 
h1 = uicontrol('Parent',h0, ... 
	'Units','points', ... 
	'BackgroundColor',[ 0.8 0.8 0.8], ... 
	'FontName','Courier', ... 
	'FontSize',8, ... 
   	'ListboxTop',0, ... 
   	'HorizontalAlignment','Left',... 
	'Position',[33.75 127 300 12], ... 
	'String',s1, ... 
	'Style','text', ... 
	'Tag','StaticText3',... 
          'Visible',EnableString3); 
DPCHformatHandle3 = uicontrol('Parent',h0, ... 
	'Units','points', ... 
	'BackgroundColor',[1 1 1], ... 
	'FontName','Courier', ... 
	'ListboxTop',0, ... 
	'Position',[29.25 105.25 300 20.25], ... 
	'String',s, ... 
	'Style','popupmenu', ... 
	'Tag','DPCH #3 Popup Menu', ... 
   	'Value',1,... 
          'Visible',EnableString3,... 
          'Enable',EnableString3); 
 
%Objects for DPCH #4 Format 
 
h1 = uicontrol('Parent',h0, ... 
	'Units','points', ... 
	'BackgroundColor',[ 0.8 0.8 0.8], ... 
	'FontSize',10, ... 
	'ListboxTop',0, ... 
	'Position',[33.75 92.5 50 12], ... 
	'String',s24, ... 
	'Style','text', ... 
   	'Tag','StaticText3',... 
          'Visible',EnableString4); 
h1 = uicontrol('Parent',h0, ... 
	'Units','points', ... 
	'BackgroundColor',[ 0.8 0.8 0.8], ... 
	'FontName','Courier', ... 
	'FontSize',8, ... 
   	'ListboxTop',0, ... 
   	'HorizontalAlignment','Left',... 
	'Position',[33.75 76.5 300 12], ... 
	'String',s1, ... 
	'Style','text', ... 
	'Tag','StaticText3',... 
          'Visible',EnableString4); 
DPCHformatHandle4 = uicontrol('Parent',h0, ... 
	'Units','points', ... 
	'BackgroundColor',[1 1 1], ... 
	'FontName','Courier', ... 
	'ListboxTop',0, ... 
	'Position',[32.25 54.75 300 20.25], ... 
	'String',s, ... 
	'Style','popupmenu', ... 
	'Tag','DPCH #4 Popup Menu', ... 
   	'Value',1,... 
          'Visible',EnableString4,... 
          'Enable',EnableString4); 
 
%navigation toolbars 
 
h1 = uicontrol('Parent',h0, ... 
	'Units','points', ... 
	'BackgroundColor',[0.831372549019608 0.815686274509804 0.784313725490196], ... 
	'Callback','BackDPCHcallback',... 
	'ListboxTop',0, ... 
	'Position',[188.25 12.75 62.25 16.5], ... 
	'String','<< Back', ... 
	'Tag','Pushbutton1'); 
h1 = uicontrol('Parent',h0, ... 
	'Units','points', ... 
	'BackgroundColor',[0.831372549019608 0.815686274509804 0.784313725490196], ... 
	'Callback','NextDPCHcallback',... 
	'ListboxTop',0, ... 
	'Position',[259.5 12 62.25 16.5], ... 
	'String','Next >>', ... 
	'Tag','Pushbutton1'); 
h1 = uicontrol('Parent',h0, ... 
	'Units','points', ... 
	'BackgroundColor',[0.831372549019608 0.815686274509804 0.784313725490196], ... 
  	'Callback','close',... 
	'ListboxTop',0, ... 
	'Position',[335.25 12 62.25 16.5], ... 
	'String','Cancel', ... 
          'Tag','Pushbutton1'); 
        
if nargin==1 
   FormatIDs = [0 3 5 8 11 14 17 20 23 26 29 32 35 38 41 44 47]; 
   INDEX = 4*(CallNumber-1) + (1:4); 
   N=length(sam.OtherDPCHformatID); 
   if INDEX(1) <= N 
      CurrentID = sam.OtherDPCHformatID( INDEX(1) ); 
      [fee I] = min(abs(CurrentID - FormatIDs)); 
      set(DPCHformatHandle1,'value',I); 
   end 
   if INDEX(2) <= N 
      CurrentID = sam.OtherDPCHformatID( INDEX(2) ); 
      [fee I] = min(abs(CurrentID - FormatIDs)); 
      set(DPCHformatHandle2,'value',I); 
   end 
   if INDEX(3) <= N 
      CurrentID = sam.OtherDPCHformatID( INDEX(3) ); 
      [fee I] = min(abs(CurrentID - FormatIDs)); 
      set(DPCHformatHandle3,'value',I); 
   end 
   if INDEX(4) <= N 
      CurrentID = sam.OtherDPCHformatID( INDEX(4) ); 
      [fee I] = min(abs(CurrentID - FormatIDs)); 
      set(DPCHformatHandle4,'value',I); 
   end 
    
 
end 
 
if nargout > 0, fig = h0; end