Home > classes > @ao > setZ.m

setZ

PURPOSE ^

SETZ sets the 'z' property of the ao.

SYNOPSIS ^

function varargout = setZ(varargin)

DESCRIPTION ^

 SETZ sets the 'z' property of the ao.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: SETZ sets the 'z' property of the ao.

 CALL:        ao = setZ(ao, val)
              obj = obj.setZ(plist('z', [1 2 3]);

 M-FILE INFO: Get information about this methods by calling
              >> ao.getInfo('setZ')

              Get information about a specified set-plist by calling:
              >> ao.getInfo('setZ', 'None')

 VERSION:     $Id: setZ.m,v 1.6 2008/09/05 11:05:29 ingo Exp $

 HISTORY:     31-01-2007 M Hewitson
                 Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 % SETZ sets the 'z' property of the ao.
0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0003 %
0004 % DESCRIPTION: SETZ sets the 'z' property of the ao.
0005 %
0006 % CALL:        ao = setZ(ao, val)
0007 %              obj = obj.setZ(plist('z', [1 2 3]);
0008 %
0009 % M-FILE INFO: Get information about this methods by calling
0010 %              >> ao.getInfo('setZ')
0011 %
0012 %              Get information about a specified set-plist by calling:
0013 %              >> ao.getInfo('setZ', 'None')
0014 %
0015 % VERSION:     $Id: setZ.m,v 1.6 2008/09/05 11:05:29 ingo Exp $
0016 %
0017 % HISTORY:     31-01-2007 M Hewitson
0018 %                 Creation
0019 %
0020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0021 
0022 function varargout = setZ(varargin)
0023 
0024   %%% Check if this is a call for parameters
0025   if utils.helper.isinfocall(varargin{:})
0026     varargout{1} = getInfo(varargin{3});
0027     return
0028   end
0029 
0030   %%% Internal call: Only one object + don't look for a plist
0031   if strcmp(varargin{end}, 'internal')
0032 
0033     %%% decide whether we modify the first object, or create a new one.
0034     varargin{1} = copy(varargin{1}, nargout);
0035 
0036     varargin{1}.data.setZ(varargin{2});
0037     varargout{1} = varargin{1};
0038     return
0039   end
0040 
0041   import utils.const.*
0042   utils.helper.msg(msg.MNAME, 'running %s/%s', mfilename('class'), mfilename);
0043   
0044   % Collect input variable names
0045   in_names = cell(size(varargin));
0046   for ii = 1:nargin,in_names{ii} = inputname(ii);end
0047 
0048   % Collect all AOs
0049   [as, ao_invars,rest] = utils.helper.collect_objects(varargin(:), 'ao', in_names);
0050   [pls,  invars, rest] = utils.helper.collect_objects(rest(:), 'plist');
0051 
0052   %%% If pls contains only one plist with the only key 'z' then set the
0053   %%% property with a plist.
0054   if length(pls) == 1 && isa(pls, 'plist') && nparams(pls) == 1 && isparam(pls, 'z')
0055     rest{1} = find(pls, 'z');
0056   end
0057 
0058   if numel(rest) ~= 1
0059     error('### Please specify a value for z, either in a plist or directly.');
0060   end
0061 
0062   %%% Combine plists
0063   if isempty(pls)
0064     pls = plist('z', rest{1});
0065   else
0066     pls = pls.combine(plist('z', rest{1}));
0067   end
0068 
0069   % Decide on a deep copy or a modify
0070   bs = copy(as, nargout);
0071 
0072   % Loop over AOs
0073   for j=1:numel(bs)
0074     bs(j).data.setZ(rest{1});
0075     bs(j).addHistory(getInfo, pls, ao_invars(j), bs(j).hist);
0076   end
0077 
0078   if nargout > 0
0079     varargout{1} = bs;
0080   end
0081 end
0082 
0083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0084 %                               Local Functions                               %
0085 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0086 %--------------------------------------------------------------------------
0087 % Get Info Object
0088 %--------------------------------------------------------------------------
0089 function ii = getInfo(varargin)
0090 
0091   if nargin == 1 && strcmpi(varargin{1}, 'None')
0092     sets = {};
0093     pl   = [];
0094   else
0095     sets = {'Default'};
0096     pl   = getDefaultPlist;
0097   end
0098   % Build info object
0099   ii = minfo(mfilename, 'ao', '', utils.const.categories.helper, '$Id: setZ.m,v 1.6 2008/09/05 11:05:29 ingo Exp $', sets, pl);
0100 end
0101 
0102 %--------------------------------------------------------------------------
0103 % Get Default Plist
0104 %--------------------------------------------------------------------------
0105 function pl = getDefaultPlist()
0106   pl = plist('z', '');
0107 end
0108

Generated on Mon 08-Sep-2008 13:18:47 by m2html © 2003