Home > classes > @ao > set.m

set

PURPOSE ^

SET an analysis object property.

SYNOPSIS ^

function ao = set(ao, varargin)

DESCRIPTION ^

 SET an analysis object property.

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

 DESCRIPTION: 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.html,v 1.1 2007/06/08 14:15:03 hewitson Exp $

 HISTORY: 30-01-07 M Hewitson
             Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function ao = set(ao, varargin)
0002 % SET an analysis object property.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: 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.html,v 1.1 2007/06/08 14:15:03 hewitson Exp $
0020 %
0021 % HISTORY: 30-01-07 M Hewitson
0022 %             Creation
0023 %
0024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0025 
0026 if (nargout ~= 0)
0027 
0028   propArgin = varargin;
0029   while length(propArgin) >= 2
0030     prop = propArgin{1};
0031     val  = propArgin{2};
0032     propArgin = propArgin(3:end);
0033     switch prop
0034       case 'tag'
0035         ao.tag = val;
0036       case 'name'
0037         ao.name = val;
0038       case 'provenance'
0039         ao.provenance = val;
0040       case 'comment'
0041         ao.comment = val;
0042       case 'hist'
0043         ao.hist = val;
0044       case 'data'
0045         ao.data = val;
0046         testAO(ao);
0047       case 'mfile'
0048         ao.mfile = val;
0049       case 'mfilename'
0050         ao.mfilename = val;
0051       case 'mdlfile'
0052         ao.mdlfile = val;
0053       case 'mdlfilename'
0054         ao.mdlfilename = val;
0055 
0056       %% Also pass through some parameters to data object
0057       case 'fs'
0058         d = ao.data;
0059         if isa(d, 'tsdata') || isa(d, 'fsdata')
0060           d = set(d, 'fs', val);
0061         else
0062           error('### No ''fs'' property for this data type');
0063         end
0064         ao.data = d;
0065         
0066       case 't0'
0067         
0068         d = ao.data;
0069         if isa(d, 'tsdata')
0070           d = set(d, 't0', val);
0071         else
0072           error('### No ''t0'' property for this data type');
0073         end
0074         ao.data = d;
0075 
0076       otherwise
0077         error([prop, ' is not a property of ao class']);
0078     end
0079   end
0080 
0081 else
0082   if ischar(varargin{2})
0083     error(sprintf ('### please use: %s = set(%s, ''%s'', ''%s'');', ...
0084                         inputname(1), ...
0085                         inputname(1), ...
0086                         varargin{1},  ...
0087                         varargin{2}));
0088   elseif isnumeric(varargin{2})
0089     error(sprintf ('### please use: %s = set(%s, ''%s'', %d);', ...
0090                         inputname(1), ...
0091                         inputname(1), ...
0092                         varargin{1},  ...
0093                         varargin{2}));
0094   else
0095     error(sprintf ('### please use: %s = set(%s, ''key'', ''value'');', ...
0096                         inputname(1), ...
0097                         inputname(1)));
0098   end
0099 end

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