next up previous contents
Next: iwpck2d Up: The commands in alphabetical Previous: gaussz2d   Contents

Subsections


getopts

Return the value of the 'OptionName' variable inside list 'OptionList'.


Syntax

[val] = getops(OptionList,'OptionName'[,OptionDefaultValue[,HasNoValue]])


Description

Return the value of the 'OptionName' variable inside list 'OptionList' and return a list without this option. If this variable is not present, val is empty unless a OptionDefaultValue is given. If HasNoValue is set to 1, val is set to 1 if OptionName is find, and 0 if not.


Input Data

OptionList
[LIST] The list of options and value. Its syntax follows the pattern: 'OPT1', VAL1, 'OPT2', VAL2, ...;

OptionName
[STRING] The option to seek inside OptionList;

OptionDefaultValue
[MISC] The default value to give at val if none is detected.

HasNoValue
[BOOL] Flag set to 1 if OptionName has no value (flag case).


Output Data

val
[MISC] the output value.

NewOptionList
[LIST] the new list of options without the option 'OptionName'.


Example(s)

>> [val,list] = getopts({'sigma', 1, 'rho', 2.3},'rho',7)\\
val = 2.3
list = { 'sigma', 1}
>> val = getopts({'sigma', 1, 'radian'},'radian',[],1)\\
val = 1


References


See Also

Location

tools/misc/getopts.m


next up previous contents
Next: iwpck2d Up: The commands in alphabetical Previous: gaussz2d   Contents