On 20 April 2012 12:22, Aki Vehtari <aki.veht...@aalto.fi> wrote: > 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.
Oh, I see. I missed that part of the documentation. Looks ugly but yeah, it's a matlab compatibility bug. Can you submit a patch for this? My guess is that in subsref.m, in the loop that checks the optional arguments, if the value does not validate, check if it's a string and if so, break the loop. I won't have time to do it in the next 1-2 weeks. If you have some code for testing, something that you know it works in matlab, would be great. If you submit that code to me, I can make them a test block at the end of the file (they are the %! that some functions have at the end). All I can do is try to fix it based on what it's written on their site and hope for the best (and as you can see, my interpretation is not always the right) >> 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 > @. You are right. I have just committed a change for that. Thank you, Carnë ------------------------------------------------------------------------------ For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2 _______________________________________________ Octave-dev mailing list Octave-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/octave-dev