Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Diff of /ltfatarghelper.m [5f391e] .. [84b1c9] Maximize Restore

  Switch to unified view

a/ltfatarghelper.m b/ltfatarghelper.m
...
...
11
%   Output parameters:
11
%   Output parameters:
12
%      flags       : Struct with information about flags.
12
%      flags       : Struct with information about flags.
13
%      keyvals     : Struct with key / values.
13
%      keyvals     : Struct with key / values.
14
%      varargout   : The position dependant pars. properly initialized
14
%      varargout   : The position dependant pars. properly initialized
15
%
15
%
16
%   [flags,keyvals]=LTFATARGHELPER(posdepnames,definput,arglist) assist in
16
%   `[flags,keyvals]=ltfatarghelper(posdepnames,definput,arglist)` assists in
17
%   parsing input parameters for a function in LTFAT. Parameters come in
17
%   parsing input parameters for a function in LTFAT. Parameters come in
18
%   four categories:
18
%   four categories:
19
%  
19
%  
20
%      * Position dependant parameters. These must not be strings. These are
20
%     * Position dependant parameters. These must not be strings. These are
21
%      the first parameters passed to a function, and they are really just a short way
21
%       the first parameters passed to a function, and they are really just a short way
22
%      of specifying key/value pairs. See below.
22
%       of specifying key/value pairs. See below.
23
%
23
%
24
%      * Flags. These are single string appearing after the position dependant
24
%     * Flags. These are single string appearing after the position dependant
25
%      parameters.
25
%       parameters.
26
%
26
%
27
%      * Key/value pairs. The key is always a string followed by the value, which can be
27
%     * Key/value pairs. The key is always a string followed by the value, which can be
28
%      anything.
28
%       anything.
29
%
29
%
30
%      * Expansions. These appear as flags, that expand into a pre-defined list of parameters.
30
%     * Expansions. These appear as flags, that expand into a pre-defined list of parameters.
31
%      This is a short-hand way of specifying standard sets of flags and key/value pairs.
31
%       This is a short-hand way of specifying standard sets of flags and key/value pairs.
32
%
32
%
33
%   The parameters are parsed in order, so parameters appearing later in varargin will override
33
%   The parameters are parsed in order, so parameters appearing later in varargin will override
34
%   previously set values.
34
%   previously set values.
35
%
35
%
36
%   The following example for calling LTFATARGHELPER is taken from DGT:
36
%   The following example for calling `ltfatarghelper` is taken from |dgt|_::
37
%  
37
%  
38
%C    definput.keyvals.L=[];
38
%     definput.keyvals.L=[];
39
%C    definput.flags.phase={'freqinv','timeinv'};
39
%     definput.flags.phase={'freqinv','timeinv'};
40
%C    [flags,kv]=ltfatarghelper({'L'},definput,varargin);
40
%     [flags,kv]=ltfatarghelper({'L'},definput,varargin);
41
%
41
%
42
%   The first line defines a key/value pair with the key 'L' having an initial value of []
42
%   The first line defines a key/value pair with the key `'L'` having an initial value of `[]`
43
%   (the empty matrix).
43
%   (the empty matrix).
44
%
44
%
45
%   The second line defines a group of flags by the name of 'phase'.
45
%   The second line defines a group of flags by the name of `phase`.  The
46
%   The group 'phase' contains the flags 'freqinv' and 'timeinv', which can both be specified
46
%   group `phase` contains the flags `'freqinv'` and `'timeinv'`, which can
47
%   on the command line by the user. The group-name 'phase' is just for internal use, and
47
%   both be specified on the command line by the user. The group-name
48
%   does not appear to the user. The flag mentioned first in the list will be selected by
48
%   `phase` is just for internal use, and does not appear to the user. The
49
%   flag mentioned first in the list will be selected by default, and only
49
%   default, and only one flag in a group can be selected at any time. As group can contains as
50
%   one flag in a group can be selected at any time. A group can contain as
50
%   many flags as desired.
51
%   many flags as desired.
51
%  
52
%  
52
%   The third line is the actual call to LTFATARGHELPER which defines the output 'flags' and 'kv'.
53
%   The third line is the actual call to `ltfatarghelper` which defines the
53
%   The input {'L'} indicates that the value of the parameter 'L' can also be given as the very
54
%   output `flags` and `kv`.  The input `{'L'}` indicates that the value of
54
%   first value in varargin.
55
%   the parameter `'L'` can also be given as the very first value in
56
%   varargin.
55
%
57
%
56
%   The output struct 'kv' contains the key/value pairs, so the value associated to 'L' is
58
%   The output struct `kv` contains the key/value pairs, so the value associated to `'L'` is
57
%   stored in kv.L .
59
%   stored in `kv.L`.
58
%
60
%
59
%   The output struct 'flags' contains information about the flags choosen by the user. The value
61
%   The output struct `flags` contains information about the flags choosen
60
%   of flags.phase will be set to the selected flag in the group 'phase' and additionally, the
62
%   by the user. The value of `flags.phase` will be set to the selected flag
63
%   in the group `phase` and additionally, the value of `flags.do_timeinv`
61
%   value of flags.do_timeinv will be 1 if 'timeinv' was selected and 0 otherwise, and similarly
64
%   will be 1 if `'timeinv'` was selected and 0 otherwise, and similarly for
62
%   for 'freqinv'. This allows for easy checking of selected flags.
65
%   `'freqinv'`. This allows for easy checking of selected flags.
63
%
66
%
64
%   See also: ltfatgetdefaults, ltfatsetdefaults
67
%   See also: ltfatgetdefaults, ltfatsetdefaults
65
68
66
persistent TF_CONF;
69
persistent TF_CONF;
67
70
...
...
259
varargout=cell(1,nposdep);
262
varargout=cell(1,nposdep);
260
for ii=1:nposdep
263
for ii=1:nposdep
261
    varargout(ii)={keyvals.(posdepnames{ii})};
264
    varargout(ii)={keyvals.(posdepnames{ii})};
262
end;
265
end;
263
266
264
%OLDFORMAT