help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Which behavior should I expect when using inputParser?


From: Juan Pablo Carbajal
Subject: Re: Which behavior should I expect when using inputParser?
Date: Tue, 17 Jun 2014 14:11:35 +0200

On Tue, Jun 17, 2014 at 9:04 AM, Damian <address@hidden> wrote:
> Hello,
>
> Recently I run into some unexpected (for me) behavior when using
> inputParser. Here is the example:
>
>     p = inputParser;
>     p.FunctionName = 'my_function;
>     p.CaseSensitive = true;
>     p.KeepUnmatched = true;
>
>     p = p.addOptional('local', 0, @isnumeric);
>
>     test = {'local', 15};
>
>     res = p.parse(test{:})
>
> After executing this code, the parameter 'local' appears as unmatched,
> even though is passed as parameter.
>
> If I change the KeepUnmatched attribute to 'false' I get an error
> saying that an unmatched parameter was found (namely 'local').
>
> I would expect the 'local' parameter specified in 'test' to be parsed
> without a problem. Am I missing something?
>
> I'm using Octave version 3.6.4.
>
> Thanks in advance,
> Damian.
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-octave

It seems like a bug to me. "local" has its default value so it seems
it is not parsed.
I know Carnë has been trying to replace inputParser with a matlab
equivalent one (dunno what are the diffs at the moment).
For the moment, could you use "addParamValue" and give a useful default value?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]