Home > source > @penlab > print.m

print

PURPOSE ^

Publisher (printing manager) for PenLab

SYNOPSIS ^

function [errmsg] = print(obj, minlev, maxlev, msg, varargin)

DESCRIPTION ^

 Publisher (printing manager) for PenLab
 Print 'msg' with optional data in varargin to the screen, to a log file or 
 using the user's printing routine; depending on printing level (outlev) set 
 in the option settings.
 Input:
   minlev, maxlev ... minimum (inclusive) and maximum (exclusive) output level
      when the message gets printed, levels are typically 1~5, use Inf if there
      is no maximal restriction
   msg, varargin ... message in the sprintf/fprintf format, \n is added
 Output:
   errmsg ... error message from sprintf (if any)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % Publisher (printing manager) for PenLab
0002 % Print 'msg' with optional data in varargin to the screen, to a log file or
0003 % using the user's printing routine; depending on printing level (outlev) set
0004 % in the option settings.
0005 % Input:
0006 %   minlev, maxlev ... minimum (inclusive) and maximum (exclusive) output level
0007 %      when the message gets printed, levels are typically 1~5, use Inf if there
0008 %      is no maximal restriction
0009 %   msg, varargin ... message in the sprintf/fprintf format, \n is added
0010 % Output:
0011 %   errmsg ... error message from sprintf (if any)
0012 %
0013 function [errmsg] = print(obj, minlev, maxlev, msg, varargin)
0014 
0015   errmsg=[];
0016   [text, errmsg] = sprintf(msg,varargin{:});
0017 
0018   level=obj.allopts.outlev;
0019   if (level>=minlev && level<maxlev)
0020     disp(text);
0021   end
0022 
0023   level=obj.allopts.outlev_file;
0024   if (obj.fid~=-1 && level>=minlev && level<maxlev)
0025     fprintf(obj.fid,[text '\n']);
0026   end
0027   
0028   if (~isempty(obj.allopts.user_prn))
0029     user_prn(minlev, maxlev, text);
0030   end
0031

Generated on Mon 26-Aug-2019 10:22:08 by m2html © 2005