📄 dbtwarning.m
字号:
function dbtwarning(invar, inPar1, inPar2)%DBTWARNING Displays warning messages.%%Synopsis:% dbtwarning(infoStr);% dbtwarning(infoStr, inPar1);% dbtwarning(infoStr, inPar1, inPar2);% dbtwarning on% dbtwarning off%%Description:% Display desired information if DBTWARNINGFLAG is set to ON. The% information is stored in the file .DBTWARNINGFLAG.mat in current% directory. The file .DBTWARNINGFLAG.mat is created the first time% dbtwarning is called.%%Input:% infoStr (StringT) : The string that are to be displayed.% flag (StringT) : 'on' or 'off'. Toggles warning messages.% inPar1 D (IntScalarT) : 1 gives no new line when printing message% Default is message with newline.% inPar2 D (IntScalarT) : 1 means that the text 'DBT-Info :' is to be omitted.% Default is message with this text.%%Output:%%--------%Notations:% Data type names are shown in parentheses and they start with a capital% letter and end with a capital T. Data type definitions can be found in [1]% or by "help dbtdata".% [D] = This parameter can be omitted and then a default value is used.% When the [D]-input parameter is not the last used in the call, it must be% given the value [], i.e. an empty matrix.% ... = There can be more parameters. They are explained under respective% metod or choice.%%Example:% for idx = 1:999% str = ['Wrong number' num2str(idx) '\r'];% dbtwarning(str,1)% end%for%%Software Quality:%%Known Bugs:% Using some control parameters under the windows platforms will result in% erroneous behavior, e.g. the character "\r" gives the same result as the% character "\n", LINE FEED and CARRIAGE RETURN.%% If you encounter errors when using "dbtwarning", then remove the file% ".DBTWARNINGFLAG.mat" in your current directory and clear the global% variable "DBTWARNINGFLAG". This only has to be done once. The problem% is due to an updated saved parameter that is not compatible with older % releases of DBT.%%References:%%See also:% error, dbtinfo, eetimebegin% * DBT, A Matlab Toolbox for Radar Signal Processing *% (c) FOA 1994-2000. See the file dbtright.m for copyright notice.%% Initiation : 980511 David Rejdemyhr (davrej).% Latest change : $Date: 2000/10/16 15:20:28 $ $Author: svabj $.% $Revision : 1.0 $% *************************************************************************% -- Global variables --global DBTWARNINGFLAG% -- Default values --newLine = 1;dbtWarnStr = 'DBT-Warning: ';% -- Check input parametersif (nargin > 1 & ~isempty(inPar1) & inPar1 == 1)%if (nargin > 1 & inPar1 == 1) newLine = 0;end%ifif (nargin > 2 & inPar2 == 1) dbtWarnStr = '';end%ifif (nargin < 2) newLine = 1;else newLine = 0;end%ifif (strcmp(invar, 'off') | strcmp(invar, 'on')) % Change mode DBTWARNINGFLAG = invar; save .DBTWARNINGFLAG.mat DBTWARNINGFLAGelse % -- Assure that the global variable DBTINFOFLAG exist -- if (isempty(DBTWARNINGFLAG)) % If the variable does not exist. % We have to test if the variable is empty. It always exist due % to the 'global' statement at the beginning of this function. if (exist('.DBTWARNINGFLAG.mat','file') == 2) % If the file exist. load .DBTWARNINGFLAG.mat else % If the file does not exist. Defaults to 'on'. dbtwarning('on') end%if end%if % -- Print -- if (strcmp(DBTWARNINGFLAG, 'on')) fprintf([dbtWarnStr invar]); if newLine fprintf('\n'); end%if elseif (strcmp(DBTWARNINGFLAG, 'off')) % Do nothing. else DBTWARNINGFLAG error('Unknown value of DBTWARNINGFLAG') end%ifend%if%End Of File.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -