⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 prprogress.m

📁 The pattern recognition matlab toolbox
💻 M
字号:
%PRPROGRESS Report progress of some PRTools iterative routines
%
%  PRPROGRESS ON
%
% All progress of all routines will be written to the command window.
%
%  PRPROGRESS(FID)
%
% Progress reports will be written to the file with file descriptor FID.
%
%  PRPROGRESS OFF
%  PRPROGRESS(0)
%
% Progress reporting is turned off.
%
%  PRPROGRESS
%
% Toggles between PRPROGRESS ON and PRPROGRESS OFF
%
%  LEN = PRPROGRESS(FID,FORMAT,...)
%
% Writes progress message to FID. If FID == [], the predefined destination
% (command window or file) is used. LEN is the number of written
% characters. See CLOSEMESS.
%
%  FID = PRPROGRESS
%
% Retrieves the status of PRPROGRESS
%
% Some routines (e.g. CLEVAL)  have a switch in the function call by which
% progress reporting for that routine only can be initiated.

% Copyright: R.P.W. Duin, r.p.w.duin@prtools.org
% Faculty EWI, Delft University of Technology
% P.O. Box 5031, 2600 GA Delft, The Netherlands

function fid = prprogress(par,varargin)

	persistent GLOBALPRPROGRESS
  mlock; % prevents GLOBALPRPROGRESS being cleared by CLEAR ALL

	if isempty(GLOBALPRPROGRESS)
		GLOBALPRPROGRESS = 1;
	end

	if nargin == 0 
		
		if nargout == 0
			if GLOBALPRPROGRESS ~= 0, 
				GLOBALPRPROGRESS = 0;
			else
				GLOBALPRPROGRESS = 1; 
			end
		else
			fid = GLOBALPRPROGRESS;
		end

	elseif nargin == 1 & nargout == 0
		
		if isstr(par)
			switch par
			case {'on','ON'}
				GLOBALPRPROGRESS = 1;
			case {'off','OFF'}
				GLOBALPRPROGRESS = 0;
			otherwise
				error('Illegal input for PRPROGRESS')
			end
		else
			GLOBALPRPROGRESS = par;
		end
		
	elseif (GLOBALPRPROGRESS > 0) & (~isempty(par)) & (par>0)  %DXD, fid=0 means no printing...
		
		s = sprintf(varargin{:});
		n = fprintf(par,s);
		
		if nargout > 0
			fid = length(s);
		end
		
	elseif GLOBALPRPROGRESS > 0
		
		s = sprintf(varargin{:});
		n = fprintf(GLOBALPRPROGRESS,s);
		
		if nargout > 0
			fid = length(s);
		end
		
	else
		
		if nargout > 0
			fid = 0;
		end
		
	end
	
return
	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -