Mercurial > hg > ltpda
diff m-toolbox/classes/@stattest/fromData.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/@stattest/fromData.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,58 @@ +% FROMDATA +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% FUNCTION: fromData +% +% DESCRIPTION: Construct a statistical test with the give data +% +% CALL: st = fromData(a, pl) +% +% PARAMETER: pl - plist +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function st = fromData(st, pli) + + VERSION = '$Id: fromData.m,v 1.1 2010/12/20 12:50:15 hewitson Exp $'; + + % get smodel info + ii = stattest.getInfo('stattest', 'From Data'); + + % Set the method version string in the minfo object + ii.setMversion([VERSION '-->' ii.mversion]); + + % Combine input plist with default values + pl = combine(pli, ii.plists); + + % Set fields + indata = pl.find('data'); + if ~iscell(indata) + data = {}; + for kk = 1:numel(indata) + data = [data {indata(kk)}]; + end + end + + % Check the contents of data + for kk=1:numel(data) + if ~isa(data{kk}, 'ltpda_uoh') + error('### Statistical tests need data in the form of LTPDA user objects. Cell entry %d is a %s', kk, class(data{kk})); + end + end + + % Set the data + st.data = data; + + % Add history + st.addHistory(ii, pl, [], []); + + % Set other properties + warning('off', utils.const.warnings.METHOD_NOT_FOUND); + % remove parameters we already used + pl_set = copy(pl,1); + if pl_set.isparam('data') + pl_set.remove('data'); + end + st.setProperties(pl_set); + warning('on', utils.const.warnings.METHOD_NOT_FOUND); + +end