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

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

[Octave-bug-tracker] [bug #58112] inputParser error while handling cell


From: Jukka Hynninen
Subject: [Octave-bug-tracker] [bug #58112] inputParser error while handling cell array as optional argument
Date: Sat, 4 Apr 2020 13:28:12 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0

URL:
  <https://savannah.gnu.org/bugs/?58112>

                 Summary: inputParser error while handling cell array as
optional argument
                 Project: GNU Octave
            Submitted by: jhynninen
            Submitted on: Sat 04 Apr 2020 05:28:10 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Unexpected Error
                  Status: None
             Assigned to: None
         Originator Name: Jukka Hynninen
        Originator Email: 
             Open/Closed: Open
                 Release: 5.2.0
         Discussion Lock: Any
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

Following code runs on Matlab R2018b, but gives an error on Octave:

argin = {1, {'test', 1, 2, 3}};
p = inputParser();
p.addRequired('first');
p.addOptional('second', []);
p.parse(argin{:});


error: strcmpi: nonconformant cell arrays
error: called from
    is_argname at line 534 column 11
    parse at line 403 column 9
    inputParser_test at line 5 column 1

_parse()_ method of inputParser.m calls _this.is_argname()_ method, which gets
the cell array as its _name_ argument, and fails to compare a string to a cell
array.

I added a hack into _is_argname()_ to check for _iscell(name)_ to get this
working, but it's obviously not a permanent solution.





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58112>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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