📄 comvarb.m
字号:
%scrip file for commgui
% Wes Wang 12/29/95
% Copyright (c) 1995-96 by The MathWorks, Inc.
% $Revision: 1.1 $ $Date: 1996/04/01 17:55:23 $
handle_com_tmp = get(gcf, 'UserData');
value_com_tmp1 = get(handle_com_tmp(2), 'string');
%eval(['set(', num2str(handle_com_tmp(2), 20),...
% ',''UserData'',' value_com_tmp1, ');']);
if isempty(value_com_tmp1)
error('The Signal to noise ratio variable cannot be empty.')
end;
value_com_tmp2 = get(handle_com_tmp(3), 'string');
if isempty(value_com_tmp2)
error('The Bit error ratio variable cannot be empty.')
end;
if handle_com_tmp(7)
%export
value_com_tmp = get(handle_com_tmp(6), 'UserData');
eval([value_com_tmp1 '= value_com_tmp(1,:);'])
eval([value_com_tmp2 '= value_com_tmp(2,:);'])
else
if ~exist(value_com_tmp1)
error(['Variable ', value_com_tmp1, ' does not exist.']);
end;
if ~exist(value_com_tmp2)
error(['Variable ', value_com_tmp2, ' does not exist.']);
end;
%inport
eval(['length_com_tmp = length(', value_com_tmp1,...
') - length(', value_com_tmp2, ');']);
if length_com_tmp ~= 0
error(['Variable ', value_com_tmp1, ' and ',...
value_com_tmp2, 'Must have the same length.']);
end;
eval(['length_com_tmp = length(', value_com_tmp1, ');'])
eval(['value_com_tmp = size(', value_com_tmp1, ', 1);']);
if value_com_tmp <= 0
error('Cannot assign an empty matrix.');
elseif value_com_tmp > 1
eval([value_com_tmp1, '=', value_com_tmp1, '(1,:);']);
disp('Warning: COMMGUI has inputted only the first row.');
end;
eval(['value_com_tmp = size(', value_com_tmp2, ', 1);']);
if value_com_tmp <= 0
error('Cannot assign an empty matrix.');
elseif value_com_tmp > 1
eval([value_com_tmp2, '=', value_com_tmp2, '(1,:);']);
disp('Warning: COMMGUI has inputted only the first row.');
end;
value_com_tmp = zeros(1,length_com_tmp);
eval(['value_com_tmp(1,:) = ', value_com_tmp1, ';'])
eval(['value_com_tmp(2,:) = ', value_com_tmp2, ';'])
length_com_tmp = get(handle_com_tmp(6), 'UserData');
set(length_com_tmp, 'UserData', value_com_tmp,...
'String', ['snr=',mat2str(value_com_tmp(1, :), 4),...
'; bit_err_ratio=',mat2str(value_com_tmp(2, :), 4)],...
'Visible', 'on'...
)
clear length_com_tmp
end;
clear handle_com_tmp
clear value_com_tmp1
clear value_com_tmp2
clear value_com_tmp
drawnow;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -