Mercurial > hg > ltpda
diff m-toolbox/classes/@matrix/iplot.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/@matrix/iplot.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,85 @@ +% IPLOT calls ao/iplot on all inner ao objects. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: IPLOT calls ao/iplot on all inner ao objects. +% +% CALL: obj = iplot(mat) +% obj = mat.iplot() +% +% Note: if the matrix object does not contain AOs, then an error will be +% thrown. +% +% See the help of ao/iplot for plist options. All options are passed to +% iplot. +% +% <a href="matlab:utils.helper.displayMethodInfo('matrix', 'iplot')">Parameters Description</a> +% +% VERSION: $Id: iplot.m,v 1.2 2011/08/12 09:52:15 hewitson Exp $ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function varargout = iplot(varargin) + + % Check if this is a call for parameters + if utils.helper.isinfocall(varargin{:}) + varargout{1} = getInfo(varargin{3}); + return + end + + % Collect input variable names + in_names = cell(size(varargin)); + for ii = 1:nargin,in_names{ii} = inputname(ii);end + + % Collect all matrices and plists + [as, matrix_invars, rest] = utils.helper.collect_objects(varargin(:), 'matrix', in_names); + [pl, pl_invars, rest] = utils.helper.collect_objects(varargin(:), 'plist', in_names); + + % Decide on a deep copy or a modify + bs = copy(as, nargout); + + % Combine input plists and default plist + usepl = parse(pl, getDefaultPlist()); + + for kk=1:numel(bs) + m = bs(kk); + if isa(m.objs, 'ao') + iplot(m.objs, usepl); + else + error('Input matrix %d does not contain AOs.', kk); + end + end + +end + +%-------------------------------------------------------------------------- +% Get Info Object +%-------------------------------------------------------------------------- +function ii = getInfo(varargin) + + if nargin == 1 && strcmpi(varargin{1}, 'None') + sets = {}; + pl = []; + else + sets = {'Default'}; + pl = getDefaultPlist; + end + % Build info object + ii = minfo(mfilename, 'matrix', 'ltpda', utils.const.categories.output, '$Id: iplot.m,v 1.2 2011/08/12 09:52:15 hewitson Exp $', sets, pl); +end + +%-------------------------------------------------------------------------- +% Get Default Plist +%-------------------------------------------------------------------------- + +function plout = getDefaultPlist() + persistent pl; + if ~exist('pl', 'var') || isempty(pl) + pl = buildplist(); + end + plout = pl; +end + +function pl = buildplist() + pl = plist.EMPTY_PLIST; +end +