[Top][All Lists]

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

Re: Multiple functions in a file

From: Etienne Grossmann
Subject: Re: Multiple functions in a file
Date: Sat, 11 Nov 2000 11:13:25 +0000
User-agent: WEMI/1.13.7 (Shimada) FLIM/1.13.2 (Kasanui) Emacs/20.7 (i386-debian-linux-gnu) (with unibyte mode)


From: Andy Adler <address@hidden>

#  Is it possible to put multiple function
#  definitions in a single *m file.

  In a script file (a file that does not start by a function
definition), yes. For example : 

address@hidden: cat > foo.m 
function x=foo(y)
  x= 1+bar(y);

function a=bar(b)
address@hidden: fg
octave  (wd: Šþ)

octave:16> which foo
which: `foo' is the script file
octave:17> foo
warning: function `foo' defined within script file 
octave:18> which foo
foo is a user-defined function
octave:19> foo (3)
ans = 10

  Note that I first had to call 'foo' as a script so that the
functions get declared.

  To avoid the warning, you could name the script 'foo_decl_script' or
someting alike.

#  But I'd really like to be able to do this,
#  as I don't want people to bar to be accessible directly.

  I think 'bar' will always be visible.



Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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