|
From: | Aki Vehtari |
Subject: | Re: Octave inputParser |
Date: | Fri, 20 Apr 2012 14:22:31 +0300 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.28) Gecko/20120313 Thunderbird/3.1.20 |
Hi,
How does it succeed in Matlab? This does not make sense. How can you skip the optional parameters and jump into param/value? How can one know if it's an optional parameter that does not validate or the key for a parameter?
If optional input is not a string it can not be a parameter name and there is no possibility of confusion. If optional input can be a string, then Matlab documentation says
http://www.mathworks.se/help/techdoc/matlab_prog/bresuxt-11.html"If your function accepts optional input strings and parameter name and value pairs, specify validation functions for the optional input strings. Otherwise, the Input Parser interprets the optional strings as parameter names. For example, the checkFinish validation function ensures that printPhoto interprets 'glossy' as a value for finish and not as an invalid parameter name."
Thus it is possible to leave out optional arguments even when using ParamValue arguments, too.
By the way, if you are using octave's inputParser, take a look at addSwitch which matlab hasn't implemented yet.
help @inputParser/addSwitch says "See `help @inputParser' for examples.", but it seems it should be "See `help inputParser' for examples.", ie without @.
Aki
[Prev in Thread] | Current Thread | [Next in Thread] |