[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Octave inputParser
From: |
Aki Vehtari |
Subject: |
Re: Octave inputParser |
Date: |
Fri, 20 Apr 2012 12:53:27 +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,
Thanks for the informative reply. Unfortunately I don't have time and
competence to fix octave-core bug #34478 or implement classdef.
The code you're asking for is in the general package release (1.3.0
released less than 1 month ago).
I have downloaded this code and experimented with it. I think I can manage with
the current octave API for inputParser, but there is one bug and missing
functionality in the 1.3.0 relase of inputParser.
1) Leaving out optional arguments does not work. Below is example function and
example function calls, where latter fails in Octave, but not in Matlab.
---Clip---
function a = iptest(varargin)
ip=inputParser;
ip.FunctionName = 'IPTEST';
ip=ip.addOptional('a', []);
ip=ip.addParamValue('b',[]);
ip=ip.parse(varargin{:});
a=ip.Results.a;
---Clip---
octave-3.6.1:12> iptest(1,'b',2)
ans = 1
octave-3.6.1:13> iptest('b',2)
error: IPTEST : Parameter/Switch names must be strings
error: called from:
error: /proj/bayes/ave/gpstuffbeta/octave/@inputParser/subsref.m at line 132,
column 7
error: /proj/bayes/ave/gpstuffbeta/octave/@inputParser/subsref.m at line 38,
column 11
error: /proj/bayes/ave/gpstuffbeta/octave/iptest.m at line 7, column 5
2) Matlab's inputParser accepts parameter-value pairs as a struct. It seems
that this is not yet implemented in the 1.3.0 relase of inputParser.
We might be able to fix these, but before spending time on that, I'd like to
know if someone has already fixed these or working on these?
Best,
Aki