From help-request at octave dot org Tue May 3 08:46:30 2005 Subject: Re: calling a function within a multi-function file From: Shai Ayal To: Brian Blais Cc: help at octave dot org Date: Tue, 03 May 2005 16:50:43 +0300 There is a trick you can try: The problem is that octave has no way to know that test2 is in test.m what you can do is convert rename test.m to say test_funcs.m , convert it to a script file by adding the statement 1; at the top, call test_funcs and you will now have access to both test and test2 functions. caveat: if you change the m-file, you'll have to reload it automatically for the functions to change. For sake of clarity, this is the test_funcs.m file I propose: #--- test_func.m --------------- 1; function y=test(x) y=x; endfunction function y=test2(x) y=2*x; endfunction #------------------------------ hope this helps, Shai Brian Blais wrote: > Hello, > > If I have the following function file test.m > > function y=test(x) > y=x; > endfunction > > function y=test2(x) > y=2*x; > endfunction > %------------------------------ > > > Is there a way to call function test2 directly, even though it is in > test.m? I could use the source command, but then I have to do that > manually every time I change the file. Is there another way? > > > thanks, > > Brian Blais ------------------------------------------------------------- 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 -------------------------------------------------------------