Mercurial > hg > ltpda
view m-toolbox/m/etc/user_fcn_template.m @ 40:977eb37f31cb database-connection-manager
User friendlier errors from utils.mysql.connect
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 18:04:03 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
% FOO description for function 'foo' in one line. Necessary for lookfor functionality. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % DESCRIPTION: FOO detailed description for the function 'foo' % % CALL: foo(a) % [a, b] = foo(a,pl) % % INPUTS: a - analysis object(s) % pl - parameter list(s) % % OUTPUTS: a - ??? % b - ??? % % PARAMETERS: (Add these parameters to the default parameter list) % KEY1: - parameter description % KEY2: - parameter description % % VERSION: $Id: user_fcn_template.m,v 1.1 2010/07/27 13:30:37 ingo Exp $ % % SEE ALSO: ao/cos, ao/tan, ao/asin, acos, atan % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% REMARK: This is a function template for function which are not part of %%% the LTPDA toolbox !!!!!!! function varargout = foo(varargin) import utils.const.* utils.helper.msg(msg.MNAME, 'running %s/%s', mfilename('class'), mfilename); %%% Define version string VERSION = '$Id: user_fcn_template.m,v 1.1 2010/07/27 13:30:37 ingo Exp $'; %%% Collect input variable names in_names = cell(size(varargin)); for ii = 1:nargin,in_names{ii} = inputname(ii);end %%% Collect all AOs [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names); pli = utils.helper.collect_objects(varargin(:), 'plist', in_names); %%% Decide on a deep copy or a modify %%% REMARK: If you create a new AO (call the constructor) then %%% it is not necessay to copy the input-AOs !!! bs = copy(as, nargout); %%% Combine with the default plist. This works as first come, first served. %%% (It's also necessary to copy the input plist in case we change it later %%% in this script - combine does that for you.) pl = combine(pli, getDefaultPlist); %%% go through the inputs for kk = 1:numel(bs) %%% store the input history inhists = bs(kk).hist; %%%%%%%%%% get x- and y-data %%%%%%%%%% %%%% REMARK: If you get the data in this way then are x and y always %%%% column vectors. x = bs(kk).x; y = bs(kk).y; dx = bs(kk).dx; dy = bs(kk).dy; %%%%%%%%%% some calculations %%%%%%%%%% bs(kk).setX(some_new_X_data); bs(kk).setY(some_new_Y_data); bs(kk).setFs(new_fs); bs(kk).setXunits(new_xunits); bs(kk).setYunits(new_yunits); %%% Set Name bs(kk).setName('new name'); %%%%%%%%%% Add history 'step' %%%%%%%%%% %%% REMARK: This command is a different to the addHistory because %%% 'addHistory' is a protected toolbox method and %%% addHistoryStep a public method. The difference is that %%% only the user with this method can rebuild the object. bs(kk) = addHistoryStep(bs(kk), getInfo('Default'), pl, VERSION, in_names(kk), inhists); end %%% Prepare the output if nargout == numel(bs) % List of outputs for ii = 1:numel(bs) varargout{ii} = bs(ii); end else % Single output varargout{1} = bs; end end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Local Functions % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % FUNCTION: getInfo % % DESCRIPTION: Get Info Object % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function ii = getInfo(varargin) if nargin == 1 && strcmpi(varargin{1}, 'None') sets = {}; pl = []; else sets = {'Default'}; pl = getDefaultPlist; end % Build info object ii = minfo(mfilename, 'CLASS', '', utils.const.categories.CHOOSE_ME, '$Id: user_fcn_template.m,v 1.1 2010/07/27 13:30:37 ingo Exp $', sets, pl); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % FUNCTION: getDefaultPlist % % DESCRIPTION: Get Default Plist % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function plo = getDefaultPlist() plo = plist('key1', 1, 'key2', 2); end