view m-toolbox/classes/@ao/fromXYFcn.m @ 35:4be5f7a5316f database-connection-manager

Suppress output messages on preferences loading and saving
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% FROMXYFCN Construct an ao from a function f(x) string
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% FUNCTION:    fromXYfcn
%
% DESCRIPTION: Construct an ao from a function f(x) string
%
% CALL:        a = fromXYfcn(pl)
%
% PARAMETER:   pl: Parameter list object
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function a = fromXYFcn(a, pli)
  
  VERSION = '$Id: fromXYFcn.m,v 1.9 2011/08/16 06:06:17 hewitson Exp $';
  
  % get AO info
  ii = ao.getInfo('ao', 'From XY Function');
  
  % Set the method version string in the minfo object
  ii.setMversion([VERSION '-->' ii.mversion]);
  
  % Add default values
  pl = applyDefaults(ii.plists, pli);
  pl.getSetRandState();
  
  % Get parameters
  fcn = find(pl, 'xyfcn');
  x   = find(pl, 'X');
  
  % Make data
  ts = xydata(x,eval([fcn ';']));
  
  % Make an analysis object
  a.data = ts;
  
  % Add history
  a.addHistory(ii, pl, [], []);
  
  % Set xunits
  a.setXunits(pl.find('xunits'));
  
  % Set yunits
  a.setYunits(pl.find('yunits'));
  
  % Set object properties from the plist
  a.setObjectProperties(pl);
  
end