From: Doug Stewart
To: Ian McCallion <address@hidden>
Cc: Help GNU Octave <address@hidden>
Subject: Re: Synonym
>> On Wed, Apr 8, 2020 at 7:35 AM Ian McCallion <address@hidden> wrote:
>> What is the right syntax for providing a function which does nothing except call another function with the same parameters and returns the same values back.
>>
>> The function below passes the parameters through, but getting returned values back does not work. I've tried various incantations without success
>>
>> function [varargout] = short(varargin)
>> varargout = verylongame(varargin){:})
>> endfunction
>>
>> Cheers... Ian
>>
> this seems to work!
>
> function [varargout2] = short(varargin)
> varargout = verylongname(varargin{:})
> varargout2=varargout(:)
> endfunction
>
>
> --
> DAS
Doug,
I could not get that to work when multiple output arguments are requested. My attempt is below. It’s kind of ugly, maybe someone can come up with a nicer method.
Tony
function varargout = short(varargin)
usv = nthargout ([1:nargout()], @short, varargin{:});
if isa(usv, "cell")
for i = 1:nargout
varargout{i} = usv{i};
endfor
else
varargout{1} = usv;
endif
endfunction