Mercurial > hg > ltpda
view m-toolbox/classes/@matrix/fromInput.m @ 46:ca0b8d4dcdb6 database-connection-manager
Fix
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Tue, 06 Dec 2011 19:07:27 +0100 |
parents | bc767aaa99a8 |
children |
line wrap: on
line source
% Construct a matrix object from ltpda_uoh objects. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % FUNCTION: fromInput % % DESCRIPTION: Construct a matrix object from ltpda_uoh objects. % % CALL: matrix = matrix.fromInput(inobjs) % % VERSION: $Id: fromInput.m,v 1.10 2011/12/05 07:40:23 hewitson Exp $ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function obj = fromInput(obj, pli, callerIsMethod) VERSION = '$Id: fromInput.m,v 1.10 2011/12/05 07:40:23 hewitson Exp $'; import utils.const.* if callerIsMethod % do nothing else % get AO info ii = matrix.getInfo('matrix', 'From Input'); % Set the method version string in the minfo object ii.setMversion([VERSION '-->' ii.mversion]); end % Combine input plist with default values if callerIsMethod pl = pli; else % Combine input plist with default values % TODO: the parse step should be removed and included somehow into plist/applyDefaults pl = applyDefaults(ii.plists, pli); end shape = pl.find('shape'); objs = pl.find('objs'); if iscell(objs) [inobjs, ao_invars, rest] = utils.helper.collect_objects(objs(:), ''); if ~isempty(rest) warning('LTPDA:MATRIX', '### The matrix constructor collects only all %s-objects but there are some %s-objects left.', class(inobjs), class(rest{1})); end else inobjs = objs; end if ~isempty(shape) obj.objs = reshape(inobjs, shape); else obj.objs = inobjs; end if callerIsMethod % do less else pl.pset('shape', size(obj.objs)); % Remove the input objects from the plist because we add the histories of % the input objects to the matrix object. pl.remove('objs'); inhists = []; if ~isempty(inobjs) inhists = [inobjs(:).hist]; end obj.addHistory(matrix.getInfo('matrix', 'None'), pl, [], inhists); % Set any remaining object properties which exist in the default plist obj.setObjectProperties(pl); end end