help-octave
[Top][All Lists]
Advanced

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

Re: new to octave - need help with running user-defined function files


From: Keith Goodman
Subject: Re: new to octave - need help with running user-defined function files
Date: Mon, 6 Mar 2006 20:13:53 -0800

On 3/6/06, Theresa Bullard <address@hidden> wrote:
> Dear Octave List,
>
> I am new to Octave and have loaded everything successfully and am able
> to run built-in functions and such, but I seem to be having trouble
> with getting Octave to see and run any user-defined functions. I've
> read the online manual sections dealing with this but am not clear on a
> couple points.
>
> 1. what is the appropriate syntax to use for changing LOADPATH once
> Octave is running?
>
> 2. Since I haven't figured out how to add another path for Octave to
> search in for function files, I've placed the files in one of the paths
> that is already in DEFAULT_LOADPATH
> (/usr/local/share/octave/2.1.71/site/m//), and when I use the built in
> function 'file_in_loadpath(filename)' it keeps returning empty results
> for the all of the new user-defined function files I've downloaded or
> that I've created myself. Whereas if I search for octave functions in
> the same directory path it will find them. From the manual it seems
> like I can add new function or script files even while Octave is
> running and as soon as I call the new function from the command line it
> should search the directories and then compile it on the fly, if needed
> (based on time-stamp). Is this true? If so, why is it not able to see
> these new function files or script files I've put into the default
> paths? Is there a way to force compile all these functions?
>
> Any clarification or suggestions for getting started here is much
> appreciated. I'm running Octave through X-11 in Mac OSX (10.3.9)

To see your current path enter 'path' at the Octave prompt. Notice
that the current working directory (represented by a single period) is
in your path. So you can put your new functions in a new directory and
then cd to it (either before you start Octave or after since cd is
available at the Octave prompt).

If you installed Octave-Forge then you can use addpath, rmpath, and
savepath. The syntax is addpath('/path/to/my/new/functions')

If you want to play with LOADPATH directly, then

LOADPATH = '/path/to/my/new/functions:'

The trailing colon appends the default_loadpath. You can put the colon
in front if you want to search your new directory last.

Did you use quotes and append a .m when you used file_in_loadpath?
file_in_loadpath('myfunc.m')

My advice is to ignore everything I've said except for addpath,
rmpath, and savepath. And the current working directory.



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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