view m-toolbox/classes/@stattest/fromData.m @ 27:29276498ebdb database-connection-manager

Remove LTPDARepositoryManager implementation * * * Remove GUI helper
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% 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