Home > classes > @history > set.m

set

PURPOSE ^

SET a history property.

SYNOPSIS ^

function h = set(h, varargin)

DESCRIPTION ^

 SET a history property.

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

 DESCRIPTION: 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', '0000-00-00 00:00:00');
       h = set(h, 'version', 'plist/set.m,v 1.7...');

 VERSION: $Id: set.html,v 1.1 2007/06/08 14:15:05 hewitson 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 a history property.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: 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', '0000-00-00 00:00:00');
0015 %       h = set(h, 'version', 'plist/set.m,v 1.7...');
0016 %
0017 % VERSION: $Id: set.html,v 1.1 2007/06/08 14:15:05 hewitson Exp $
0018 %
0019 % HISTORY: 30-01-07 M Hewitson
0020 %             Creation
0021 %
0022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0023 
0024 if (nargout ~= 0)
0025 
0026   propArgin = varargin;
0027 
0028   while length(propArgin) >= 2
0029     prop = varargin{1};
0030     val  = varargin{2};
0031     propArgin = propArgin(3:end);
0032     switch prop
0033       case 'name'
0034         h.name = val;
0035       case 'created'
0036         h.created = val;
0037       case 'version'
0038         h.version = val;
0039       case 'plist'
0040         h.plist = val;
0041       case 'n'
0042         h.n = val;
0043       case 'pn'
0044         h.pn = val;
0045       case 'inhists'
0046         h.inhists = val;
0047       case 'invars'
0048         h.invars = val;
0049       otherwise
0050         error([val, ' is not a property of history class']);
0051     end
0052   end
0053 
0054 else
0055   if ischar(varargin{2})
0056     error(sprintf ('### please use: %s = set(%s, ''%s'', ''%s'');', ...
0057                         inputname(1), ...
0058                         inputname(1), ...
0059                         varargin{1},  ...
0060                         varargin{2}));
0061   elseif isnumeric(varargin{2})
0062     error(sprintf ('### please use: %s = set(%s, ''%s'', %d);', ...
0063                         inputname(1), ...
0064                         inputname(1), ...
0065                         varargin{1},  ...
0066                         varargin{2}));
0067   else
0068     error(sprintf ('### please use: %s = set(%s, key, ''value'');', ...
0069                         inputname(1), ...
0070                         inputname(1)));
0071   end
0072 end

Generated on Fri 08-Jun-2007 16:09:11 by m2html © 2003