[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
number of arguments if nargout meets nargin (was Re: plot templates and
From: |
Thorsten Meyer |
Subject: |
number of arguments if nargout meets nargin (was Re: plot templates and options lists for set, plot etc.) |
Date: |
Sat, 06 Jun 2009 19:00:42 +0200 |
User-agent: |
Mozilla-Thunderbird 2.0.0.19 (X11/20090103) |
Benjamin Lindner wrote:
>> Also, I would like to wrap this transformation into a function. I
>> tried it like
>> this (in octave compiled from the current tip):
>>
>> function varargout = struct2options (structure)
>> varargout = {fieldnames(structure)'{:}; struct2cell(structure)'{:}};
>> nargout
>> endfunction
>>
>
> this should read
>
> function c = struct2opt(s)
> c = reshape(cat(2, fieldnames(s), struct2cell(s)).',1,[]);
> endfunction
>
> then
> plot(1:5, 5:-1:1, struct2opt(style){:})
> should work
Yes, that is a way how to do it. However, I would like to eliminate the
{:} part :-)
Also, the more general question is interesting to me: can I somehow
control how many arguments are passed in this nested function call:
function1(function2())
if function 2 has varargout and function 1 has varargin
Thorsten
- plot templates and options lists for set, plot etc., Thorsten Meyer, 2009/06/06
- Re: plot templates and options lists for set, plot etc., Ben Abbott, 2009/06/06
- Re: plot templates and options lists for set, plot etc., Thorsten Meyer, 2009/06/06
- Re: plot templates and options lists for set, plot etc., John W. Eaton, 2009/06/07
- Re: plot templates and options lists for set, plot etc., Ben Abbott, 2009/06/07
- Re: plot templates and options lists for set, plot etc., John W. Eaton, 2009/06/07
Re: plot templates and options lists for set, plot etc., Benjamin Lindner, 2009/06/06
- number of arguments if nargout meets nargin (was Re: plot templates and options lists for set, plot etc.),
Thorsten Meyer <=