octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #52420] inputParser optional argument is "not


From: anonymous
Subject: [Octave-bug-tracker] [bug #52420] inputParser optional argument is "not a valid parameter"
Date: Thu, 16 Nov 2017 08:31:09 -0500 (EST)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/604.3.5 (KHTML, like Gecko) Version/11.0.1 Safari/604.3.5

URL:
  <http://savannah.gnu.org/bugs/?52420>

                 Summary: inputParser optional argument is "not a valid
parameter"
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Thu 16 Nov 2017 01:31:08 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: Ryan Govostes
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.0.3
        Operating System: Mac OS

    _______________________________________________________

Details:

I'm running some code originally written for MATLAB which uses an inputParser
to parse arguments. Here's a reduced example:


function foo(a, varargin)
    p = inputParser();
    addOptional(p, 'sigma', 0, @isnumeric);
    parse(p, varargin{:});
    p.Results.sigma
end


When I invoke this, I get an unexpected error:


>> foo(3, 'sigma', 3)
error: argument 'SIGMA' is not a valid parameter
error: called from
    error at line 480 column 7
    parse at line 397 column 13
    foo at line 4 column 5


I'm not very familiar with MATLAB but the documentation for function input
parsing seems to suggest that this code is correct and that Octave's behavior
deviates from MATLAB's.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?52420>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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