Home > chronux_2_00 > spikesort > utility > matlabtools > printf.m

printf

PURPOSE ^

PRINTF Macro to display formatted text.

SYNOPSIS ^

function errmsg = printf(format,varargin)

DESCRIPTION ^

PRINTF            Macro to display formatted text.
   PRINTF(FORMAT,A,...) is equivalent to DISP(SPRINTF(FORMAT,A,...)),
   displaying formatted text to the Matlab prompt.  Thus, e.g., 

            PRINTF('repeat %d.', 1);
            DISP(SPRINTF('repeat %d.', 1));
   and      DISP(['repeat ' num2str(1) '.']);

   are all are functionally equivalent.  However, (1) SPRINTF is 
   dramatically faster than NUM2STR and (2) SPRINTF interprets control
   sequences such as '\n' (linefeed).

   ERRMSG = PRINTF(...) optionally returns any error message produced by
   SPRINTF, or an empty matrix if no error occurred.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function errmsg = printf(format,varargin)
0002 %PRINTF            Macro to display formatted text.
0003 %   PRINTF(FORMAT,A,...) is equivalent to DISP(SPRINTF(FORMAT,A,...)),
0004 %   displaying formatted text to the Matlab prompt.  Thus, e.g.,
0005 %
0006 %            PRINTF('repeat %d.', 1);
0007 %            DISP(SPRINTF('repeat %d.', 1));
0008 %   and      DISP(['repeat ' num2str(1) '.']);
0009 %
0010 %   are all are functionally equivalent.  However, (1) SPRINTF is
0011 %   dramatically faster than NUM2STR and (2) SPRINTF interprets control
0012 %   sequences such as '\n' (linefeed).
0013 %
0014 %   ERRMSG = PRINTF(...) optionally returns any error message produced by
0015 %   SPRINTF, or an empty matrix if no error occurred.
0016 
0017 [s,errmsg] = sprintf(format,varargin{:});
0018 if (isempty(errmsg)), disp(s); end;
0019 if (nargout == 0), clear errmsg; end;

Generated on Fri 15-Aug-2008 11:35:42 by m2html © 2003