Home > classes > @history > set.m

set

PURPOSE ^

SET set a history property.

SYNOPSIS ^

function h = set(h, varargin)

DESCRIPTION ^

 SET set a history property.

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

 DESCRIPTION: SET set a history property.

 CALL: h = set(h, 'name',    'name');
       h = set(h, 'inhist',   history);
       h = set(h, 'invars',   {});
       h = set(h, 'plist',    plist);
       h = set(h, 'n',        n);
       h = set(h, 'pn',       pn);
       h = set(H, 'created',  time());
       h = set(h, 'version', 'history/set.m,v 1.7...');
       h = set(h, 'consver', 'history/set.m,v 1.7...');

 VERSION: $Id: set.m,v 1.10 2007/12/05 16:26:22 ingo Exp $

 HISTORY: 30-01-07 M Hewitson
             Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function h = set(h, varargin)
0002 % SET set a history property.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: SET set a history property.
0007 %
0008 % CALL: h = set(h, 'name',    'name');
0009 %       h = set(h, 'inhist',   history);
0010 %       h = set(h, 'invars',   {});
0011 %       h = set(h, 'plist',    plist);
0012 %       h = set(h, 'n',        n);
0013 %       h = set(h, 'pn',       pn);
0014 %       h = set(H, 'created',  time());
0015 %       h = set(h, 'version', 'history/set.m,v 1.7...');
0016 %       h = set(h, 'consver', 'history/set.m,v 1.7...');
0017 %
0018 % VERSION: $Id: set.m,v 1.10 2007/12/05 16:26:22 ingo Exp $
0019 %
0020 % HISTORY: 30-01-07 M Hewitson
0021 %             Creation
0022 %
0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0024 
0025 VERSION  = '$Id: set.m,v 1.10 2007/12/05 16:26:22 ingo Exp $';
0026 
0027 % Check if this is a call for parameters
0028 if nargin == 2
0029   if isa(h, 'history') && ischar(varargin{1})
0030     in = char(varargin{1});
0031     if strcmp(in, 'Params')
0032       h = plist;
0033       return
0034     elseif strcmp(in, 'Version')
0035       h = VERSION;
0036       return
0037     end
0038   end
0039 end
0040 
0041 if (nargout ~= 0)
0042 
0043   propArgin = varargin;
0044 
0045   while length(propArgin) >= 2
0046     prop = varargin{1};
0047     val  = varargin{2};
0048     propArgin = propArgin(3:end);
0049     switch prop
0050       case 'name'
0051         h.name = val;
0052       case 'created'
0053         h.created = val;
0054       case 'version'
0055         h.version = val;
0056       case 'plist'
0057         h.plist = val;
0058       case 'n'
0059         h.n = val;
0060       case 'pn'
0061         h.pn = val;
0062       case 'inhists'
0063         h.inhists = val;
0064       case 'invars'
0065         h.invars = val;
0066       case 'consver'
0067         h.consver = val;
0068       otherwise
0069         error([val, ' is not a property of history class']);
0070     end
0071   end
0072 
0073 else
0074   if ischar(varargin{2})
0075     error('### please use: %s = set(%s, ''%s'', ''%s'');', ...
0076                         inputname(1), ...
0077                         inputname(1), ...
0078                         varargin{1},  ...
0079                         varargin{2});
0080   elseif isnumeric(varargin{2})
0081     error('### please use: %s = set(%s, ''%s'', %d);', ...
0082                         inputname(1), ...
0083                         inputname(1), ...
0084                         varargin{1},  ...
0085                         varargin{2});
0086   else
0087     error('### please use: %s = set(%s, key, ''value'');', ...
0088                         inputname(1), ...
0089                         inputname(1));
0090   end
0091 end

Generated on Tue 22-Jan-2008 10:39:13 by m2html © 2003