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 write
Home > sltoolbox > fileio > @sllog > write.m

write

PURPOSE ^

WRITE Writes message to a logger

SYNOPSIS ^

function write(logger, varargin)

DESCRIPTION ^

WRITE Writes message to a logger

 $ Syntax $
   - write(logger, ...)

 $ Description $
   - write(logger, ...) writes message to a logger. The contents given
     should be as sprintf.

 $ History $
   - Created by Dahua Lin, on Aug 12nd, 2006

CROSS-REFERENCE INFORMATION ^

This function calls:
  • disp DISP displays the dataset fields
This function is called by:
  • edl_batchexp EDL_BATCHEXP Performs Batch experiments according to scheme
  • edl_go EDL_GO The Top interface for doing experiments in EDL
  • edl_logerror EDL_LOGERROR Logs an error into logger
  • writeinfo WRITEINFO Writes information to logger without time-stamp

SOURCE CODE ^

0001 function write(logger, varargin)
0002 %WRITE Writes message to a logger
0003 %
0004 % $ Syntax $
0005 %   - write(logger, ...)
0006 %
0007 % $ Description $
0008 %   - write(logger, ...) writes message to a logger. The contents given
0009 %     should be as sprintf.
0010 %
0011 % $ History $
0012 %   - Created by Dahua Lin, on Aug 12nd, 2006
0013 %
0014 
0015 
0016 if ~logger.winshow && isempty(logger.files)
0017     return;
0018 end
0019 
0020 % generate string
0021 
0022 indent_step = 4;    
0023 ns = max(logger.indent, 0);
0024 
0025 if logger.timestamp
0026     tstr = datestr(now(), logger.timeformat);
0027     nblanks = ns * indent_step + 2;
0028     str = [tstr, blanks(nblanks), sprintf(varargin{:})];
0029 else
0030     if ns == 0
0031         str = sprintf(varargin{:});
0032     else
0033         nblanks = ns * indent_step;
0034         str = [blanks(nblanks), sprintf(varargin{:})];
0035     end
0036 end
0037 
0038 % write it
0039 
0040 if logger.winshow
0041     disp(str);
0042 end
0043 
0044 if ~isempty(logger.files)
0045     
0046     F = logger.files;
0047     nf = length(F);
0048     for i = 1 : nf        
0049         if F(i).isactive
0050             fprintf(F(i).fid, '%s\n', str);
0051         end        
0052     end
0053         
0054 end
0055     
0056 
0057     
0058     
0059     
0060     
0061

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

Contact us at files@mathworks.com