Home > classes > @zero > char.m

char

PURPOSE ^

CHAR convert a zero object into a string.

SYNOPSIS ^

function pstr = char(p, varargin)

DESCRIPTION ^

 CHAR convert a zero object into a string.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: CHAR convert a zero object into a string.

 CALL:        string = char(zero);

 VERSION:     $Id: char.html,v 1.14 2008/03/31 10:27:37 hewitson Exp $

 HISTORY:     02-04-2007 Hewitson
                 Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function pstr = char(p, varargin)
0002 % CHAR convert a zero object into a string.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: CHAR convert a zero object into a string.
0007 %
0008 % CALL:        string = char(zero);
0009 %
0010 % VERSION:     $Id: char.html,v 1.14 2008/03/31 10:27:37 hewitson Exp $
0011 %
0012 % HISTORY:     02-04-2007 Hewitson
0013 %                 Creation
0014 %
0015 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0016 
0017 VERSION  = '$Id: char.html,v 1.14 2008/03/31 10:27:37 hewitson Exp $';
0018 CATEGORY = 'Output';
0019 
0020 % Check if this is a call for parameters
0021 if nargin == 2
0022   if isa(p, 'zero') && ischar(varargin{1})
0023     in = char(varargin{1});
0024     if strcmp(in, 'Params')
0025       pstr = plist;
0026       return
0027     elseif strcmp(in, 'Version')
0028       pstr = VERSION;
0029       return
0030     elseif strcmp(in, 'Category')
0031       pstr = CATEGORY;
0032       return
0033     end
0034   end
0035 end
0036 
0037 pstr = ['zero(' num2str(p.f)];
0038 if p.q > 0.5
0039   pstr = [pstr ',' num2str(p.q)];
0040 end
0041 pstr = [pstr ')'];
0042 
0043 pstr = strrep(pstr, '_', '\_');
0044 
0045 % END

Generated on Mon 31-Mar-2008 12:20:24 by m2html © 2003