Mercurial > hg > ltpda
diff m-toolbox/classes/@ltpda_uoh/fromModel.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children | bc767aaa99a8 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/@ltpda_uoh/fromModel.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,33 @@ +% FROMMODEL Construct an a built in model +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% FUNCTION: fromModel +% +% DESCRIPTION: Construct an ltpda uder objects with history from a +% built-in model +% +% CALL: a = fromModel(a, pl) +% +% PARAMETER: pl: Parameter list object +% +% VERSION: $Id: fromModel.m,v 1.13 2011/08/15 12:59:04 hewitson Exp $ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function obj = fromModel(obj, pl) + + [obj, ii, fcnname] = fromModel@ltpda_uo(obj, pl); + % Add history + try + feval(fcnname, 'info'); + catch + % if the model doesn't respond to an 'info' call, then it is an old + % style model and we need to add history. + obj.addHistory(ii, pl, [], []); + end + + % Set object properties + obj.setObjectProperties(pl); + +end +