Mercurial > hg > ltpda
view m-toolbox/classes/@matrix/split.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 source
% SPLIT splits a matrix object into the specified segments. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % DESCRIPTION: SPLIT splits a matrix object into the specified segments. % % CALL: out = split(in,pl); % % Note: this is just a wrapper of ao/split. Each AO in the matrix is passed % to split with the input plist. % % INPUTS: in - input matrix objects % pl - parameter list % % OUTPUTS: out - output matrix objects % % <a href="matlab:utils.helper.displayMethodInfo('matrix', 'split')">Parameters Description</a> % % VERSION: $Id: split.m,v 1.9 2011/08/23 13:51:02 hewitson Exp $ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function varargout = split(varargin) % Check if this is a call for parameters if utils.helper.isinfocall(varargin{:}) varargout{1} = getInfo(varargin{3}); return end if nargout == 0 error('### Matrix split method can not be used as a modifier.'); end % Collect input variable names in_names = cell(size(varargin)); for ii = 1:nargin in_names{ii} = inputname(ii); end % Collect all smodels and plists [ms, matrix_invars, rest] = utils.helper.collect_objects(varargin(:), 'matrix', in_names); [pl, pl_invars, rest] = utils.helper.collect_objects(varargin(:), 'plist', in_names); % call the matrix wrapper varargout{1} = wrapper(ms, pl, getInfo('None'), in_names, 'split'); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Local Functions % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % FUNCTION: getInfo % % DESCRIPTION: Get Info Object % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function ii = getInfo(varargin) if nargin == 1 && strcmpi(varargin{1}, 'None') sets = {}; pls = []; else ii = ao.getInfo('split'); sets = ii.sets; pls = []; for kk=1:numel(sets) pls = [pls getDefaultPlist(sets{kk})]; end end % Build info object ii = minfo(mfilename, 'matrix', 'ltpda', utils.const.categories.aop, '$Id: split.m,v 1.9 2011/08/23 13:51:02 hewitson Exp $', sets, pls); ii.setArgsmin(2); ii.setModifier(false); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % FUNCTION: getDefaultPlist % % DESCRIPTION: Get Default Plist % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %-------------------------------------------------------------------------- % Get Default Plist %-------------------------------------------------------------------------- function plout = getDefaultPlist(set) persistent pl; persistent lastset; if exist('pl', 'var')==0 || isempty(pl) || ~strcmp(lastset, set) pl = buildplist(set); lastset = set; end plout = pl; end function pl = buildplist(set) ii = ao.getInfo('split', set); pl = ii.plists(1); end