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.9 2007/07/30 12:18:28 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.9 2007/07/30 12:18:28 ingo Exp $
0019 %
0020 % HISTORY: 30-01-07 M Hewitson
0021 %             Creation
0022 %
0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0024 
0025 if (nargout ~= 0)
0026 
0027   propArgin = varargin;
0028 
0029   while length(propArgin) >= 2
0030     prop = varargin{1};
0031     val  = varargin{2};
0032     propArgin = propArgin(3:end);
0033     switch prop
0034       case 'name'
0035         h.name = val;
0036       case 'created'
0037         h.created = val;
0038       case 'version'
0039         h.version = val;
0040       case 'plist'
0041         h.plist = val;
0042       case 'n'
0043         h.n = val;
0044       case 'pn'
0045         h.pn = val;
0046       case 'inhists'
0047         h.inhists = val;
0048       case 'invars'
0049         h.invars = val;
0050       case 'consver'
0051         h.consver = val;
0052       otherwise
0053         error([val, ' is not a property of history class']);
0054     end
0055   end
0056 
0057 else
0058   if ischar(varargin{2})
0059     error('### please use: %s = set(%s, ''%s'', ''%s'');', ...
0060                         inputname(1), ...
0061                         inputname(1), ...
0062                         varargin{1},  ...
0063                         varargin{2});
0064   elseif isnumeric(varargin{2})
0065     error('### please use: %s = set(%s, ''%s'', %d);', ...
0066                         inputname(1), ...
0067                         inputname(1), ...
0068                         varargin{1},  ...
0069                         varargin{2});
0070   else
0071     error('### please use: %s = set(%s, key, ''value'');', ...
0072                         inputname(1), ...
0073                         inputname(1));
0074   end
0075 end

Generated on Mon 03-Sep-2007 12:12:34 by m2html © 2003