[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: varargin daisy-chaining
From: |
David Bateman |
Subject: |
Re: varargin daisy-chaining |
Date: |
Fri, 23 Nov 2007 09:27:49 +0100 |
User-agent: |
Thunderbird 1.5.0.7 (X11/20060921) |
Pascal Dupuis wrote:
> Hello,
>
> I wanted to wrap a function call in another one, adding some argument
> through the varargin mechanism. I wrote this code:
>
> function resu = outer(varargin)
>
> %# add supplemental terms in the varargin list
> varargin = {"some_name", some_val, varagin{:}}
>
> %# expand once again varargin to have a list, and not a single cell
> resu = inner(varagin{:})
> endfunction
>
> It does work, but is it the right way to add supplemental terms to the
> varargin list ? Will this work with future releases of octave ?
>
> TIA
>
Its one way of doing it and it should always works. An alternative is just
function resu = outer(varargin)
resu = inner("some_name", some_val, varagin{:})
endfunction
which should probably be faster..
D.
--
David Bateman address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary