Home > classes > @ao > set.m

set

PURPOSE ^

SET set an analysis object property.

SYNOPSIS ^

function ao = set(ao, varargin)

DESCRIPTION ^

 SET set an analysis object property.

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

 DESCRIPTION: SET set an analysis object property.

 CALL: ao = set(ao, 'name',       'name');
       ao = set(ao, 'tag',         tag);
       ao = set(ao, 'provenance',  provenance);
       ao = set(ao, 'comment',    'comment');
       ao = set(ao, 'hist',        history);
       ao = set(ao, 'data',        data);
       ao = set(ao, 'mfile',       mfile);
       ao = set(ao, 'mfilename',  'mfilename');
       ao = set(ao, 'mdlfile',    'mdlfile');
       ao = set(ao, 'mdlfilename','mdlfilename');

 VERSION: $Id: set.m,v 1.15 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:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function ao = set(ao, varargin)
0002 % SET set an analysis object property.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: SET set an analysis object property.
0007 %
0008 % CALL: ao = set(ao, 'name',       'name');
0009 %       ao = set(ao, 'tag',         tag);
0010 %       ao = set(ao, 'provenance',  provenance);
0011 %       ao = set(ao, 'comment',    'comment');
0012 %       ao = set(ao, 'hist',        history);
0013 %       ao = set(ao, 'data',        data);
0014 %       ao = set(ao, 'mfile',       mfile);
0015 %       ao = set(ao, 'mfilename',  'mfilename');
0016 %       ao = set(ao, 'mdlfile',    'mdlfile');
0017 %       ao = set(ao, 'mdlfilename','mdlfilename');
0018 %
0019 % VERSION: $Id: set.m,v 1.15 2007/07/30 12:18:28 ingo Exp $
0020 %
0021 % HISTORY: 30-01-07 M Hewitson
0022 %             Creation
0023 %
0024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0025 
0026 % Check if this is a call for parameters
0027 if nargin == 2
0028   if isa(ao, 'ao') && ischar(varargin{1})
0029     in = char(varargin{1});
0030     if strcmp(in, 'Params')
0031       ao = getDefaultPL();
0032       return
0033     end
0034   end
0035 end
0036 
0037 
0038 if (nargout ~= 0)
0039 
0040   propArgin = varargin;
0041   while length(propArgin) >= 2
0042     prop = propArgin{1};
0043     val  = propArgin{2};
0044     propArgin = propArgin(3:end);
0045     switch prop
0046       case 'tag'
0047         ao.tag = val;
0048       case 'name'
0049         ao.name = val;
0050       case 'provenance'
0051         ao.provenance = val;
0052       case 'comment'
0053         ao.comment = val;
0054       case 'hist'
0055         ao.hist = val;
0056       case 'data'
0057         ao.data = val;
0058         testAO(ao);
0059       case 'mfile'
0060         ao.mfile = val;
0061       case 'mfilename'
0062         ao.mfilename = val;
0063       case 'mdlfile'
0064         ao.mdlfile = val;
0065       case 'mdlfilename'
0066         ao.mdlfilename = val;
0067 
0068       %% Also pass through some parameters to data object
0069       case 'fs'
0070         d = ao.data;
0071         if isa(d, 'tsdata') || isa(d, 'fsdata')
0072           d = set(d, 'fs', val);
0073         else
0074           error('### No ''fs'' property for this data type');
0075         end
0076         ao.data = d;
0077 
0078       case 't0'
0079 
0080         d = ao.data;
0081         if isa(d, 'tsdata')
0082           d = set(d, 't0', val);
0083         else
0084           error('### ''t0'' is not from the class time');
0085         end
0086         ao.data = d;
0087 
0088       otherwise
0089         error([prop, ' is not a property of ao class']);
0090     end
0091   end
0092 
0093 else
0094   if ischar(varargin{2})
0095     error('### please use: %s = set(%s, ''%s'', ''%s'');', ...
0096                         inputname(1), ...
0097                         inputname(1), ...
0098                         varargin{1},  ...
0099                         varargin{2});
0100   elseif isnumeric(varargin{2})
0101     error('### please use: %s = set(%s, ''%s'', %d);', ...
0102                         inputname(1), ...
0103                         inputname(1), ...
0104                         varargin{1},  ...
0105                         varargin{2});
0106   else
0107     error('### please use: %s = set(%s, ''key'', ''value'');', ...
0108                         inputname(1), ...
0109                         inputname(1));
0110   end
0111 end
0112 
0113 
0114 % Get default params
0115 function plo = getDefaultPL()
0116 
0117 disp('* creating default plist...');
0118 plo = plist();
0119 disp('* done.');

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