[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `argn' ? … still part of Octave ?
From: |
Ben Abbott |
Subject: |
Re: `argn' ? … still part of Octave ? |
Date: |
Mon, 24 Oct 2011 08:23:16 -0400 |
On Oct 24, 2011, at 6:09 AM, Carnë Draug wrote:
> On 23 October 2011 19:21, Ben Abbott <address@hidden> wrote:
>> On Oct 5, 2011, at 9:31 PM, Carnë Draug wrote:
>>
>>> On 6 October 2011 01:27, John W. Eaton <address@hidden> wrote:
>>>> | idea is to use arg (or inputname) to get the name of the variable in
>>>> | the caller and change its value with assignin('caller',...)
>>>>
>>>> OK, I guess you can try that, but it will be somewhat slow and
>>>> it seems to me that it will definitely be clumsy.
>>>
>>> I know. But the class I'm trying to implement (inputParser) already
>>> exists in MatLab. It's for the sake of compatibility. And I'm learning
>>> something new in the process too :)
>>>
>>> Carnë
>>
>> Carnë,
>>
>> Any progress on implementing a compliant inputParser?
>>
>> I had contacted Nico Schlomer and cooperated with him to modify his
>> matlab2tikz to allow it to run on Octave. He had made good use of Matlab's
>> inputParser. The replacement used by matlab2tikz contains much of the same
>> functionality.
>>
>> http://win.ua.ac.be/~nschloe/content/matlab2tikz
>>
>> You may find some code there that is helpful toward your effort (Take a look
>> at matlab2tikzInputParser.m)
>
> Hi Ben,
>
> yes. I finished it some days ago but I still need to write the
> documentation and would like to test it a bit more before submitting
> it ( https://gitorious.org/octave-devel/inputparser ). I do not have
> matlab to test how compliant it is, I've just been following what they
> have written on the inputParser documentation. Hopefully it'll be
> ready sometime during next weekend.
>
> But thank you for the link. I looked on the way he did it and found it
> very interesting how he mimicked an object by creating a struct with
> fields that are simply function handles for functions that were only
> in scope when the struct was created.
>
> Carnë
The parser code now used by matalbtikz is mostly mine. I has originally tried
to do what you are working on. My original code with the "@inputParser"
directory is attached.
There is a simple example from the ML docs below.
p = inputParser;
p.addRequired('a');
p.addOptional('b',1);
p.addParamValue('c',2);
p.parse(10, 20, 'c', 30);
res = p.Results
res =
a: 10
b: 20
c: 30
I was unable to fake the self modifying methods (I'll take a look at how you
did that later today). Instead, my implementation works as ...
p = inputParser;
p = p.addRequired(p, 'a');
p = p.addOptional(p, 'b',1);
p = p.addParamValue(p, 'c',2);
p = p.parse(p, 10, 20, 'c', 30);
res = p.Results
res =
a: 10
b: 20
c: 30
Ben
.
@inputParser.zip
Description: Zip archive
- `argn' ? … still part of Octave?, (continued)
- `argn' ? … still part of Octave?, John W. Eaton, 2011/10/05
- Re: `argn' ? … still part of Octave ?, Ben Abbott, 2011/10/05
- Re: `argn' ? … still part of Octave?, Carnë Draug, 2011/10/05
- Re: `argn' ? … still part of Octave?, John W. Eaton, 2011/10/05
- Re: `argn' ? … still part of Octave ?, Ben Abbott, 2011/10/05
- Re: `argn' ? … still part of Octave?, Carnë Draug, 2011/10/05
- Re: `argn' ? … still part of Octave ?, Ben Abbott, 2011/10/06
- Re: `argn' ? … still part of Octave ?, John W. Eaton, 2011/10/06
- Re: `argn' ? … still part of Octave ?, Ben Abbott, 2011/10/23
- Re: `argn' ? … still part of Octave?, Carnë Draug, 2011/10/24
- Re: `argn' ? … still part of Octave ?,
Ben Abbott <=
- Re: `argn' ? … still part of Octave?, Carnë Draug, 2011/10/24
- Re: `argn' ? … still part of Octave ?, Ben Abbott, 2011/10/24
- Re: `argn' ? … still part of Octave?, Carnë Draug, 2011/10/25
- Re: `argn' ? … still part of Octave ?, Ben Abbott, 2011/10/25
- Message not available
- Message not available
- Re: `argn' ? … still part of Octave?, Carnë Draug, 2011/10/26
- Re: `argn' ? … still part of Octave?, John W. Eaton, 2011/10/05
- Re: `argn' ? … still part of Octave?, Carnë Draug, 2011/10/06
- Re: `argn' ? … still part of Octave?, John W. Eaton, 2011/10/06