Mercurial > hg > ltpda
comparison m-toolbox/classes/+utils/@helper/process_smodel_diff_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_DIFF_OPTIONS checks the options for the parameters needed | |
3 % by smodel methods like diff | |
4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
5 % | |
6 % DESCRIPTION: PROCESS_SMODEL_DIFF_OPTIONS checks the options for the parameters needed | |
7 % by smodel methods like diff. Checked options/parameters are: | |
8 % - var | |
9 % - n | |
10 % | |
11 % CALL: pl = process_smodel_options(pl, rest) | |
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: var - the variable to act with respect to | |
19 % pl_out - the revised plist, with the variable to act with | |
20 % respect to added | |
21 % | |
22 % VERSION: $Id: process_smodel_diff_options.m,v 1.2 2011/03/04 06:14:54 mauro Exp $ | |
23 % | |
24 % HISTORY: 04-09-2009 M Hueller | |
25 % Creation | |
26 % | |
27 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
28 | |
29 function varargout = process_smodel_diff_options(pl, rest) | |
30 % Necessary for debug messages | |
31 import utils.const.* | |
32 | |
33 % Select the variable to use and the order | |
34 % Input as a string or in a plist | |
35 | |
36 % First look for values inside the plist | |
37 var = find(pl, 'var'); | |
38 n = find(pl, 'n'); | |
39 | |
40 % Then look for arguments inside a list (strings and/or numbers) | |
41 switch numel(rest) | |
42 case 0 | |
43 % Nothing to do | |
44 case 1 | |
45 % Inputs in a list of arguments | |
46 if ischar(rest{1}) | |
47 var = rest{1}; | |
48 else | |
49 n = rest{1}; | |
50 end | |
51 case 2 | |
52 if ischar(rest{1}) | |
53 var = rest{1}; | |
54 n = rest{2}; | |
55 else | |
56 var = rest{2}; | |
57 n = rest{1}; | |
58 end | |
59 otherwise | |
60 error('### Not sure what to say here'); | |
61 end | |
62 | |
63 if isempty(n) | |
64 n = 1; | |
65 end | |
66 | |
67 p_var = plist('var', var, 'n', n); | |
68 | |
69 % Combine plists | |
70 usepl = combine(p_var, pl); | |
71 | |
72 switch nargout | |
73 case 2 | |
74 varargout{1} = var; | |
75 varargout{2} = usepl; | |
76 case 3 | |
77 varargout{1} = var; | |
78 varargout{2} = n; | |
79 varargout{3} = usepl; | |
80 end | |
81 end |