Mercurial > hg > ltpda
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % FROMDATA | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % FUNCTION: fromData | |
5 % | |
6 % DESCRIPTION: Construct a statistical test with the give data | |
7 % | |
8 % CALL: st = fromData(a, pl) | |
9 % | |
10 % PARAMETER: pl - plist | |
11 % | |
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
13 function st = fromData(st, pli) | |
14 | |
15 VERSION = '$Id: fromData.m,v 1.1 2010/12/20 12:50:15 hewitson Exp $'; | |
16 | |
17 % get smodel info | |
18 ii = stattest.getInfo('stattest', 'From Data'); | |
19 | |
20 % Set the method version string in the minfo object | |
21 ii.setMversion([VERSION '-->' ii.mversion]); | |
22 | |
23 % Combine input plist with default values | |
24 pl = combine(pli, ii.plists); | |
25 | |
26 % Set fields | |
27 indata = pl.find('data'); | |
28 if ~iscell(indata) | |
29 data = {}; | |
30 for kk = 1:numel(indata) | |
31 data = [data {indata(kk)}]; | |
32 end | |
33 end | |
34 | |
35 % Check the contents of data | |
36 for kk=1:numel(data) | |
37 if ~isa(data{kk}, 'ltpda_uoh') | |
38 error('### Statistical tests need data in the form of LTPDA user objects. Cell entry %d is a %s', kk, class(data{kk})); | |
39 end | |
40 end | |
41 | |
42 % Set the data | |
43 st.data = data; | |
44 | |
45 % Add history | |
46 st.addHistory(ii, pl, [], []); | |
47 | |
48 % Set other properties | |
49 warning('off', utils.const.warnings.METHOD_NOT_FOUND); | |
50 % remove parameters we already used | |
51 pl_set = copy(pl,1); | |
52 if pl_set.isparam('data') | |
53 pl_set.remove('data'); | |
54 end | |
55 st.setProperties(pl_set); | |
56 warning('on', utils.const.warnings.METHOD_NOT_FOUND); | |
57 | |
58 end |