📄 dbtinfo.m
字号:
function dbtinfo(invar, inPar1, inPar2)%DBTINFO Displays information messages.%%Synopsis:% dbtinfo(infoStr)% dbtinfo(infoStr, inPar1);% dbtinfo(infoStr, inPar1, inPar2);% dbtinfo(flag);% dbtinfo on% dbtinfo off%%Description:% Displays information messages. The forms "dbtinfo on" and " dbtinfo off"% turns the printing on and off respectively.%% The desired information is displayed if the global variable "DBTINFOFLAG"% is set to 'on'. The value of "DBTINFOFLAG" is also stored in the file% ".DBTINFOFLAG.mat" in the current directory. This file is created by% "dbtinfo" if it does not exist.%% It is also possible to use special format carachters such as '\r' and% other, see the function "sprintf" for more detailed information.%%Input:% infoStr (StringT) : The string that are to be displayed.% flag (StringT) : = 'on or 'off'. Toggles messages.% inPar1 [D](IntScalarT) : 1 causes the next output to be on the beginning % of the same line as the current message. And % consequentially no newline is made.% 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:% 1) dbtinfo on: Toggles the message system ON.% 2) dbtinfo('Some message'): Displays the message if messages is enabled.% 3)for idx = 1:999% str = ['Wrong number' num2str(idx) '\r'];% dbtinfo(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 "dbtinfo", then remove the file% ".DBTINFOFLAG.mat" in your current directory and clear the global% variable "DBTINFOFLAG". 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:% dbtwarning, 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:24 $ $Author: svabj $.% $Revision : 1.0 $% *************************************************************************% -- Global variables --global DBTINFOFLAG% -- Default values --newLine = 1;dbtInfoStr = 'DBT-Info: ';% -- Check input parametersif (nargin > 1 & ~isempty(inPar1) & inPar1 == 1)%if (nargin > 1 & inPar1 == 1) newLine = 0;end%ifif (nargin > 2 & inPar2 == 1) dbtInfoStr = '';end%ifif (strcmp(invar, 'off') | strcmp(invar, 'on')) % Change mode. % -- Change mode -- DBTINFOFLAG = invar; save .DBTINFOFLAG.mat DBTINFOFLAGelse % Print information % -- Assure that the global variable DBTINFOFLAG exist -- if (isempty(DBTINFOFLAG)) % 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('.DBTINFOFLAG.mat','file') == 2) % If the file exist. load .DBTINFOFLAG.mat else % If the file does not exist. Defaults to 'on'. dbtinfo('on') end%if end%if % -- Print -- if (strcmp(DBTINFOFLAG, 'on')) fprintf([dbtInfoStr invar]); if newLine fprintf('\n'); end%if elseif (strcmp(DBTINFOFLAG, 'off')) % Do nothing. else DBTINFOFLAG error('Unknown value of DBTINFOFLAG') end%ifend%if%End Of File.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -