Code covered by the BSD License  

Highlights from
Statistical Learning Toolbox

from Statistical Learning Toolbox by Dahua Lin
Functions for statistical learning, pattern recognition and computer vision, covering many topics.

Description of slsharedisp
Home > sltoolbox > utils > slsharedisp.m

slsharedisp

PURPOSE ^

SLSHAREDISP Displays message using a shared configuration

SYNOPSIS ^

function slsharedisp(varargin)

DESCRIPTION ^

SLSHAREDISP Displays message using a shared configuration

 $ Syntax $
   - slsharedisp(...)

 $ Description $
   - slsharedisp(...) is to tackle the problem of sharing displaying
     configuration across different level of functions. It uses a
     global struct to record the displaying options, and the options
     can be tuned by each function and passed the invoked ones. 
     The struct is encapsulated, the user should use the following
     function to manipulate the options.
       - slsharedisp_attach:    attach current function to global display
       - slsharedisp_detach:    detach current function from it
       - slsharedisp_incindent: increase the indent of global display
       - slsharedisp_decindent: decrease the indent of global display
       - slsharedisp_reset:     reset the global display
     This function is to display message using current option. 
     The input can be either a string or follow the regulation of
     sprintf.

 $ Remarks $
   - The global display should be attached by some functions before
     being used to display message.
   - The action of attaching or detaching should be in pair. 
   - If the global display is not detached due to occurrence of error,
     it can be reset.
   - when no function is attached to the global display, it will be
     automatically cleared.
   
 $ History $
   - Created by Dahua Lin, on Aug 29, 2006

CROSS-REFERENCE INFORMATION ^

This function calls:
  • disp DISP displays the dataset fields
This function is called by:
  • slkmeansex SLKMEANSEX Performs Generalized K-means
  • sliterproc SLITERPROC Runs a general iterative process
  • slproglearn SLPROGLEARN Performs Progressive Learning from sample source
  • slreevallearn SLREEVALLEARN Performs an iterative learning based on re-evaluation
  • slfmm SLFMM Learns a Finite Mixture Model (FMM)

SOURCE CODE ^

0001 function slsharedisp(varargin)
0002 %SLSHAREDISP Displays message using a shared configuration
0003 %
0004 % $ Syntax $
0005 %   - slsharedisp(...)
0006 %
0007 % $ Description $
0008 %   - slsharedisp(...) is to tackle the problem of sharing displaying
0009 %     configuration across different level of functions. It uses a
0010 %     global struct to record the displaying options, and the options
0011 %     can be tuned by each function and passed the invoked ones.
0012 %     The struct is encapsulated, the user should use the following
0013 %     function to manipulate the options.
0014 %       - slsharedisp_attach:    attach current function to global display
0015 %       - slsharedisp_detach:    detach current function from it
0016 %       - slsharedisp_incindent: increase the indent of global display
0017 %       - slsharedisp_decindent: decrease the indent of global display
0018 %       - slsharedisp_reset:     reset the global display
0019 %     This function is to display message using current option.
0020 %     The input can be either a string or follow the regulation of
0021 %     sprintf.
0022 %
0023 % $ Remarks $
0024 %   - The global display should be attached by some functions before
0025 %     being used to display message.
0026 %   - The action of attaching or detaching should be in pair.
0027 %   - If the global display is not detached due to occurrence of error,
0028 %     it can be reset.
0029 %   - when no function is attached to the global display, it will be
0030 %     automatically cleared.
0031 %
0032 % $ History $
0033 %   - Created by Dahua Lin, on Aug 29, 2006
0034 %
0035 
0036 global GLOBAL_SHARE_DISPLAYER;
0037 global GLOBAL_SHARE_DISPLAYER_LINEBREAK;
0038 
0039 if isempty(GLOBAL_SHARE_DISPLAYER)
0040     error('sltoolbox:gdisperr', ...
0041         'The global displayer is not open');
0042 end
0043 
0044 if isempty(GLOBAL_SHARE_DISPLAYER_LINEBREAK)
0045     GLOBAL_SHARE_DISPLAYER_LINEBREAK = true;
0046 end
0047 
0048 s = GLOBAL_SHARE_DISPLAYER(end);
0049 
0050 if s.show && ~isempty(varargin)
0051     nblanks = s.indent * s.indentstep;
0052     if length(varargin) == 1
0053         strmsg = varargin{1};
0054     else
0055         strmsg = sprintf(varargin{:});
0056     end
0057     if nblanks > 0 && GLOBAL_SHARE_DISPLAYER_LINEBREAK
0058         strmsg = [blanks(nblanks), strmsg];
0059     end
0060     disp(strmsg);
0061 end
0062 
0063 GLOBAL_SHARE_DISPLAYER_LINEBREAK = true;    
0064     
0065

Generated on Wed 20-Sep-2006 12:43:11 by m2html © 2003

Contact us at files@mathworks.com