?? ui_check_params.m
字號:
function ui_check_params
persistent state;
if isempty(state)
state = struct('FrmLen', '130', 'NumofPkt', '100','corr_value','0');
end
curr_obj = gcbo;
obj_tag = get(curr_obj,'Tag');
% performs logical check on input parameters
switch (obj_tag)
case 'FrmLen'
Frm_len_str = get(curr_obj,'String');
try
Frm_len = eval(Frm_len_str);
if Frm_len <= 0
set(curr_obj, 'String', state.FrmLen);
errordlg('Frame length must be positive','Invalid input', 'modal');
else
state = setfield(state, 'FrmLen', Frm_len_str);
end
catch
set(curr_obj,'String', state.FrmLen);
errordlg('Frame length value not a number','Invalid input', 'modal');
end
case 'NumofPkt'
pkts_to_simulate_str = get(curr_obj, 'String');
try
pkts_to_simulate = eval(pkts_to_simulate_str);
if pkts_to_simulate < 0
set(curr_obj,'String', state.NumofPkt);
errordlg('Packets to simulate cannot be negative','Invalid input', 'modal');
else
state = setfield(state, 'NumofPkt', pkts_to_simulate_str);
end
catch
set(curr_obj,'String', state.NumofPkt);
errordlg('Packets to simulate value not a number','Invalid input', 'modal');
end
case '1Tx'
oneTx = get(findobj('Tag', '1Tx'),'Value');
if oneTx==1
twoTx=findobj('Tag', '2Tx');
threeTx=findobj('Tag', '3Tx');
fourTx=findobj('Tag', '4Tx');
set(twoTx,'Value',0);
set(threeTx,'Value',0);
set(fourTx,'Value',0);
end
case '2Tx'
twoTx = get(findobj('Tag', '2Tx'),'Value');
if twoTx==1
oneTx=findobj('Tag', '1Tx');
threeTx=findobj('Tag', '3Tx');
fourTx=findobj('Tag', '4Tx');
set(oneTx,'Value',0);
set(threeTx,'Value',0);
set(fourTx,'Value',0);
end
case '3Tx'
threeTx = get(findobj('Tag', '3Tx'),'Value');
if threeTx==1
twoTx=findobj('Tag', '2Tx');
oneTx=findobj('Tag', '1Tx');
fourTx=findobj('Tag', '4Tx');
set(twoTx,'Value',0);
set(oneTx,'Value',0);
set(fourTx,'Value',0);
end
case '4Tx'
fourTx = get(findobj('Tag', '4Tx'),'Value');
if fourTx==1
twoTx=findobj('Tag', '2Tx');
threeTx=findobj('Tag', '3Tx');
oneTx=findobj('Tag', '1Tx');
set(twoTx,'Value',0);
set(threeTx,'Value',0);
set(oneTx,'Value',0);
end
case '1Rx'
oneRx = get(findobj('Tag', '1Rx'),'Value');
if oneRx==1
twoRx=findobj('Tag', '2Rx');
threeRx=findobj('Tag', '3Rx');
fourRx=findobj('Tag', '4Rx');
set(twoRx,'Value',0);
set(threeRx,'Value',0);
set(fourRx,'Value',0);
end
case '2Rx'
twoRx = get(findobj('Tag', '2Rx'),'Value');
if twoRx==1
oneRx=findobj('Tag', '1Rx');
threeRx=findobj('Tag', '3Rx');
fourRx=findobj('Tag', '4Rx');
set(oneRx,'Value',0);
set(threeRx,'Value',0);
set(fourRx,'Value',0);
end
case '3Rx'
threeRx = get(findobj('Tag', '3Rx'),'Value');
if threeRx==1
twoRx=findobj('Tag', '2Rx');
oneRx=findobj('Tag', '1Rx');
fourRx=findobj('Tag', '4Rx');
set(twoRx,'Value',0);
set(oneRx,'Value',0);
set(fourRx,'Value',0);
end
case '4Rx'
fourRx = get(findobj('Tag', '4Rx'),'Value');
if fourRx==1
twoRx=findobj('Tag', '2Rx');
threeRx=findobj('Tag', '3Rx');
oneRx=findobj('Tag', '1Rx');
set(twoRx,'Value',0);
set(threeRx,'Value',0);
set(oneRx,'Value',0);
end
case 'AWGN '
awgn = get(findobj('Tag', 'AWGN '),'Value');
if awgn==1
rayleigh=findobj('Tag', 'Rayleigh');
set(rayleigh,'Value',0);
end
case 'Rayleigh'
rayleigh = get(findobj('Tag', 'Rayleigh'),'Value');
if rayleigh==1
awgn=findobj('Tag', 'AWGN ');
set(awgn,'Value',0);
end
case 'Channel_Est'
ch_est = get(findobj('Tag', 'Channel_Est'),'Value');
if ch_est==1
oneRx=findobj('Tag', '1Rx');
set(oneRx,'Value',0);
twoRx=findobj('Tag', '2Rx');
set(twoRx,'Value',1);
threeRx=findobj('Tag', '3Rx');
set(threeRx,'Value',0);
fourRx=findobj('Tag', '4Rx');
set(fourRx,'Value',0);
end
if ch_est==1
oneTx=findobj('Tag', '1Tx');
set(oneTx,'Value',0);
twoTx=findobj('Tag', '2Tx');
set(twoTx,'Value',1);
threeTx=findobj('Tag', '3Tx');
set(threeTx,'Value',0);
fourTx=findobj('Tag', '4Tx');
set(fourTx,'Value',0);
end
case 'Rx_corr'
rx_corr = get(findobj('Tag', 'Rx_corr'),'Value');
if rx_corr==1
oneRx=findobj('Tag', '1Rx');
set(oneRx,'Value',0);
twoRx=findobj('Tag', '2Rx');
set(twoRx,'Value',1);
threeRx=findobj('Tag', '3Rx');
set(threeRx,'Value',0);
fourRx=findobj('Tag', '4Rx');
set(fourRx,'Value',0);
end
if rx_corr==1
oneTx=findobj('Tag', '1Tx');
set(oneTx,'Value',0);
twoTx=findobj('Tag', '2Tx');
set(twoTx,'Value',1);
threeTx=findobj('Tag', '3Tx');
set(threeTx,'Value',0);
fourTx=findobj('Tag', '4Tx');
set(fourTx,'Value',0);
end
case 'corr_value'
corr_val_str=str2double(get(curr_obj,'String'));
otherwise
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -