help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: number of arguments if nargout meets nargin (was Re: plot templates


From: Benjamin Lindner
Subject: Re: number of arguments if nargout meets nargin (was Re: plot templates and options lists for set, plot etc.)
Date: Sat, 06 Jun 2009 19:09:12 +0200
User-agent: Thunderbird 2.0.0.18 (Windows/20081105)

Thorsten Meyer wrote:
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


I don't know a way to control this, so I stick to the {:} suffix :)
But yes, I agree that this is the fundamental question behind it.
Sorry I cannot offer a solution...

benjamin


reply via email to

[Prev in Thread] Current Thread [Next in Thread]