comparison m-toolbox/classes/+utils/@helper/process_smodel_transf_options.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
2 % PROCESS_SMODEL_TRANSF_OPTIONS checks the options for the parameters needed
3 % by smodel methods like transforms
4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5 %
6 % DESCRIPTION: PROCESS_SMODEL_TRANSF_OPTIONS checks the options for the parameters needed
7 % by smodel methods like transforms. Checked options/parameters are:
8 % - in_var
9 % - ret_var
10 %
11 % CALL: pl = process_smodel_transf_options(pl, type, varargin)
12 %
13 % INPUTS:
14 % pl - the parameter list passed by user
15 % rest - the list of user inputs to search for variable
16 % definition by string
17 %
18 % OUTPUTS: in_var - the variable to act with respect to
19 % ret_var - the variable to transform into
20 % pl_out - the revised plist, with the variable to act with
21 % respect to added
22 %
23 % VERSION: $Id: process_smodel_transf_options.m,v 1.1 2009/09/18 06:57:34 mauro Exp $
24 %
25 % HISTORY: 04-09-2009 M Hueller
26 % Creation
27 %
28 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
29
30 function varargout = process_smodel_transf_options(pl, rest)
31 % Necessary for debug messages
32 import utils.const.*
33
34 % Select the variable to use and the order
35 % Input as a string or in a plist
36
37 % First look for values inside the plist
38 in_var = find(pl, 'in_var');
39 ret_var = find(pl, 'ret_var');
40
41 % Then look for arguments inside a list (strings and/or numbers)
42 switch numel(rest)
43 case 0
44 % Nothing to do
45 case 1
46 % Inputs in a list of arguments
47 ret_var = rest{1};
48 case 2
49 in_var = rest{1};
50 ret_var = rest{2};
51 otherwise
52 error('### Not sure what to say here');
53 end
54
55 p_var = plist('in_var', in_var, 'ret_var', ret_var);
56
57 % Combine plists
58 usepl = combine(pl, p_var);
59
60 switch nargout
61 case 2
62 varargout{1} = ret_var;
63 varargout{2} = usepl;
64 case 3
65 varargout{1} = in_var;
66 varargout{2} = ret_var;
67 varargout{3} = usepl;
68 end
69 end