www.pudn.com > SpacetimeMatlabCode.rar > ui_read_options.m, change:2004-03-04,size:3481b


function sim_options = ui_read_options 
 
% frame length, in symbols 
Frm_length = eval(get(findobj('Tag', 'FrmLen'),'String')); 
 
% number of packets 
NumberofPackets = eval(get(findobj('Tag', 'NumofPkt'),'String')); 
 
% Modulation 
modulation = get(findobj('Tag', 'Modulation'),'String'); 
modulation = modulation(get(findobj('Tag', 'Modulation'),'Value'),:); 
 
% Channel models 
if get(findobj('Tag', 'AWGN    '),'Value') 
   chan_model = 'AWGN    '; 
elseif get(findobj('Tag', 'Rayleigh'),'Value') 
   chan_model = 'Rayleigh'; 
end 
 
% Rx Diversity options 
oneRx = get(findobj('Tag', '1Rx'),'Value'); 
if oneRx==1 
    rx_div=1; 
end 
twoRx = get(findobj('Tag', '2Rx'),'Value'); 
if twoRx==1 
    rx_div=2; 
end 
threeRx = get(findobj('Tag', '3Rx'),'Value'); 
if threeRx==1 
    rx_div=3; 
end 
fourRx = get(findobj('Tag', '4Rx'),'Value'); 
if fourRx==1 
    rx_div=4; 
end 
% Tx Diversity options 
oneTx = get(findobj('Tag', '1Tx'),'Value'); 
if oneTx==1 
    tx_div=1; 
end 
twoTx = get(findobj('Tag', '2Tx'),'Value'); 
if twoTx==1 
    tx_div=2; 
end 
threeTx = get(findobj('Tag', '3Tx'),'Value'); 
if threeTx==1 
    tx_div=3; 
end 
fourTx = get(findobj('Tag', '4Tx'),'Value'); 
if fourTx==1 
    tx_div=4; 
end 
if isempty(rx_div) 
    rx_div=2; 
end 
if isempty(tx_div) 
    tx_div=2; 
end 
if rx_div==1 & tx_div==1 
      uiwait(errordlg('STBC not applicable for SISO systems!! Program will exit to Command line.','Invalid Input','Modal')); 
      return; 
end 
if (rx_div==3 & tx_div==1) || (rx_div==3 & tx_div==2) || (rx_div==4 & tx_div==2) || (rx_div==2 & tx_div==3) || ... 
           (rx_div==3 & tx_div==3) || (rx_div==2 & tx_div==4) || (rx_div==3 & tx_div==4) 
      uiwait(errordlg('STBC not coded for 1x3, 2x3, 2x4, 3x2, 3x3, 4x2 and 4x3 systems!!Program will exit to Command line.','Invalid Input','Modal')); 
      return; 
end 
          
% channel estimation 
ch_est=get(findobj('Tag', 'Channel_Est'),'Value'); 
if ch_est==1 & (rx_div~=2 || tx_div~=2) 
    uiwait(errordlg('Channel Estimation: Code programmed for 2x2 system only!! Program will exit to Command line','Invalid Input','Modal')); 
    return; 
end 
 
%receive correlation 
rx_corr=get(findobj('Tag', 'Rx_corr'),'Value'); 
 
%Save file 
savefile=get(findobj('Tag', 'Savefile'),'Value'); 
filename = get(findobj('Tag', 'FileName'),'String'); 
 
str1=filename; 
if isempty(str1) & savefile==1 
uiwait(errordlg('Enter file name!! Program will exit to Command line','Invalid Input','Modal')); 
return; 
end 
 
%correlation coefficient 
Rx_corr=get(findobj('Tag', 'Rx_corr'),'Value'); 
corr_val_str=eval(get(findobj('Tag', 'corr_value'),'String')); 
 
if corr_val_str==0 & Rx_corr==1 || corr_val_str  0 || corr_val_str > 1 
uiwait(errordlg('Enter correlation coefficient value between 0 and 1!! Press CNTL+C to exit to Command line.','Invalid Input','Modal')); 
return; 
end 
 
Rx_corr=get(findobj('Tag', 'Rx_corr'),'Value'); 
if Rx_corr==1 & (rx_div~=2 || tx_div~=2) 
    uiwait(errordlg('Receive Correlation: Code programmed for 2x2 system only!! Press CNTL+C to exit to Command line.','Invalid Input','Modal')); 
    return; 
end 
 
sim_options = struct('FrmLen', Frm_length, ... 
   'NumberofPackets', NumberofPackets, ... 
   'Modulation',modulation, ... 
   'ChannelModel',chan_model, ... 
   'TxDiv',tx_div, ... 
   'RxDiv',rx_div, ... 
   'Channel_Est',ch_est, ... 
   'Rx_corr', rx_corr, ... 
   'corr_value',corr_val_str, ... 
   'Savefile',savefile,... 
   'FileName',filename);