From help-octave-request at bevo dot che dot wisc dot edu Mon Jan 19 22:56:14 2004 Subject: matlab nargin() function alternative in octave? From: "John W. Eaton" To: sbungay at uoguelph dot ca Cc: help-octave at bevo dot che dot wisc dot edu Date: Mon, 19 Jan 2004 22:54:12 -0600 On 19-Jan-2004, Sharene Deanne Bungay wrote: | I have some matlab code that I would very much like | to use under octave. Unfortunately, the matlab code | relies on matlab's ability to pass a function as an | argument to nargin ( eg. nargin('sin')) and have it return | the number of arguments expected by that function. | I know that under octave, nargin is only a local scope scalar | valid inside a given function, but does there exist a means | under octave to get the number of expected arguments to a function | (outside the scope of that function)? | | (This functionality is required since I have functions that are | conditionally defined to take different arguments, and subsequent | behaviour requires knowledge of the number of arguments. Rewriting | the code to use global variables instead of relying on the form of | the function definitions would be too extensive, so any help | on this matter would be *GREATLY* appreciated.) Can you post an actual example that uses this functionality so we can see how you are using it and why it is needed? The Matlab documentation shows that nargin and nargout may accept string arguments. Are function handles also allowed? Thanks, jwe ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------