Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 3e60ff9d4d6f58c8fbd17208f14089fa > files > 270

octave-doc-3.2.3-3mdv2010.0.i586.rpm

<html lang="en">
<head>
<title>Manipulating the load path - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Function-Files.html#Function-Files" title="Function Files">
<link rel="next" href="Subfunctions.html#Subfunctions" title="Subfunctions">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="Manipulating-the-load-path"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Subfunctions.html#Subfunctions">Subfunctions</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Function-Files.html#Function-Files">Function Files</a>
<hr>
</div>

<h4 class="subsection">11.7.1 Manipulating the load path</h4>

<p>When a function is called, Octave searches a list of directories for
a file that contains the function declaration.  This list of directories
is known as the load path.  By default the load path contains
a list of directories distributed with Octave plus the current
working directory.  To see your current load path call the <code>path</code>
function without any input or output arguments.

   <p>It is possible to add or remove directories to or from the load path
using <code>addpath</code> and <code>rmpath</code>.  As an example, the following
code adds &lsquo;<samp><span class="samp">~/Octave</span></samp>&rsquo; to the load path.

<pre class="example">     addpath("~/Octave")
</pre>
   <p class="noindent">After this the directory &lsquo;<samp><span class="samp">~/Octave</span></samp>&rsquo; will be searched for functions.

<!-- load-path.cc -->
   <p><a name="doc_002daddpath"></a>

<div class="defun">
&mdash; Built-in Function:  <b>addpath</b> (<var>dir1, <small class="dots">...</small></var>)<var><a name="index-addpath-621"></a></var><br>
&mdash; Built-in Function:  <b>addpath</b> (<var>dir1, <small class="dots">...</small>, option</var>)<var><a name="index-addpath-622"></a></var><br>
<blockquote><p>Add <var>dir1</var>, <small class="dots">...</small> to the current function search path.  If
<var>option</var> is &lsquo;<samp><span class="samp">"-begin"</span></samp>&rsquo; or 0 (the default), prepend the
directory name to the current path.  If <var>option</var> is &lsquo;<samp><span class="samp">"-end"</span></samp>&rsquo;
or 1, append the directory name to the current path. 
Directories added to the path must exist. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dpath.html#doc_002dpath">path</a>, <a href="doc_002drmpath.html#doc_002drmpath">rmpath</a>, <a href="doc_002dgenpath.html#doc_002dgenpath">genpath</a>, <a href="doc_002dpathdef.html#doc_002dpathdef">pathdef</a>, <a href="doc_002dsavepath.html#doc_002dsavepath">savepath</a>, <a href="doc_002dpathsep.html#doc_002dpathsep">pathsep</a>. 
</p></blockquote></div>

<!-- load-path.cc -->
   <p><a name="doc_002dgenpath"></a>

<div class="defun">
&mdash; Built-in Function:  <b>genpath</b> (<var>dir</var>)<var><a name="index-genpath-623"></a></var><br>
<blockquote><p>Return a path constructed from <var>dir</var> and all its subdirectories. 
</p></blockquote></div>

<!-- load-path.cc -->
   <p><a name="doc_002drmpath"></a>

<div class="defun">
&mdash; Built-in Function:  <b>rmpath</b> (<var>dir1, <small class="dots">...</small></var>)<var><a name="index-rmpath-624"></a></var><br>
<blockquote><p>Remove <var>dir1</var>, <small class="dots">...</small> from the current function search path.

     <!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
     <!-- A simple blank line produces the correct behavior. -->
     <!-- @sp 1 -->
     <p class="noindent"><strong>See also:</strong> <a href="doc_002dpath.html#doc_002dpath">path</a>, <a href="doc_002daddpath.html#doc_002daddpath">addpath</a>, <a href="doc_002dgenpath.html#doc_002dgenpath">genpath</a>, <a href="doc_002dpathdef.html#doc_002dpathdef">pathdef</a>, <a href="doc_002dsavepath.html#doc_002dsavepath">savepath</a>, <a href="doc_002dpathsep.html#doc_002dpathsep">pathsep</a>. 
</p></blockquote></div>

<!-- ./path/savepath.m -->
   <p><a name="doc_002dsavepath"></a>

<div class="defun">
&mdash; Function File:  <b>savepath</b> (<var>file</var>)<var><a name="index-savepath-625"></a></var><br>
<blockquote><p>Save the portion of the current function search path, that is
not set during Octave's initialization process, to <var>file</var>. 
If <var>file</var> is omitted, <samp><span class="file">~/.octaverc</span></samp> is used.  If successful,
<code>savepath</code> returns 0. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dpath.html#doc_002dpath">path</a>, <a href="doc_002daddpath.html#doc_002daddpath">addpath</a>, <a href="doc_002drmpath.html#doc_002drmpath">rmpath</a>, <a href="doc_002dgenpath.html#doc_002dgenpath">genpath</a>, <a href="doc_002dpathdef.html#doc_002dpathdef">pathdef</a>, <a href="doc_002dpathsep.html#doc_002dpathsep">pathsep</a>. 
</p></blockquote></div>

<!-- load-path.cc -->
   <p><a name="doc_002dpath"></a>

<div class="defun">
&mdash; Built-in Function:  <b>path</b> (<var><small class="dots">...</small></var>)<var><a name="index-path-626"></a></var><br>
<blockquote><p>Modify or display Octave's load path.

        <p>If <var>nargin</var> and <var>nargout</var> are zero, display the elements of
Octave's load path in an easy to read format.

        <p>If <var>nargin</var> is zero and nargout is greater than zero, return the
current load path.

        <p>If <var>nargin</var> is greater than zero, concatenate the arguments,
separating them with <code>pathsep()</code>.  Set the internal search path
to the result and return it.

        <p>No checks are made for duplicate elements. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002daddpath.html#doc_002daddpath">addpath</a>, <a href="doc_002drmpath.html#doc_002drmpath">rmpath</a>, <a href="doc_002dgenpath.html#doc_002dgenpath">genpath</a>, <a href="doc_002dpathdef.html#doc_002dpathdef">pathdef</a>, <a href="doc_002dsavepath.html#doc_002dsavepath">savepath</a>, <a href="doc_002dpathsep.html#doc_002dpathsep">pathsep</a>. 
</p></blockquote></div>

<!-- ./path/pathdef.m -->
   <p><a name="doc_002dpathdef"></a>

<div class="defun">
&mdash; Function File: <var>val</var> = <b>pathdef</b> ()<var><a name="index-pathdef-627"></a></var><br>
<blockquote><p>Return the default path for Octave. 
The path information is extracted from one of three sources. 
In order of preference, those are;

          <ol type=1 start=1>
<li><samp><span class="file">~/.octaverc</span></samp>
<li><samp><span class="file">&lt;octave-home&gt;/.../&lt;version&gt;/m/startup/octaverc</span></samp>
<li>Octave's path prior to changes by any octaverc.
             </ol>
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dpath.html#doc_002dpath">path</a>, <a href="doc_002daddpath.html#doc_002daddpath">addpath</a>, <a href="doc_002drmpath.html#doc_002drmpath">rmpath</a>, <a href="doc_002dgenpath.html#doc_002dgenpath">genpath</a>, <a href="doc_002dsavepath.html#doc_002dsavepath">savepath</a>, <a href="doc_002dpathsep.html#doc_002dpathsep">pathsep</a>. 
</p></blockquote></div>

<!-- dirfns.cc -->
   <p><a name="doc_002dpathsep"></a>

<div class="defun">
&mdash; Built-in Function: <var>val</var> = <b>pathsep</b> ()<var><a name="index-pathsep-628"></a></var><br>
&mdash; Built-in Function: <var>old_val</var> = <b>pathsep</b> (<var>new_val</var>)<var><a name="index-pathsep-629"></a></var><br>
<blockquote><p>Query or set the character used to separate directories in
a path. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dfilesep.html#doc_002dfilesep">filesep</a>, <a href="doc_002ddir.html#doc_002ddir">dir</a>, <a href="doc_002dls.html#doc_002dls">ls</a>. 
</p></blockquote></div>

<!-- load-path.cc -->
   <p><a name="doc_002drehash"></a>

<div class="defun">
&mdash; Built-in Function:  <b>rehash</b> ()<var><a name="index-rehash-630"></a></var><br>
<blockquote><p>Reinitialize Octave's load path directory cache. 
</p></blockquote></div>

<!-- utils.cc -->
   <p><a name="doc_002dfile_005fin_005floadpath"></a>

<div class="defun">
&mdash; Built-in Function:  <b>file_in_loadpath</b> (<var>file</var>)<var><a name="index-file_005fin_005floadpath-631"></a></var><br>
&mdash; Built-in Function:  <b>file_in_loadpath</b> (<var>file, "all"</var>)<var><a name="index-file_005fin_005floadpath-632"></a></var><br>
<blockquote>
        <p>Return the absolute name of <var>file</var> if it can be found in
the list of directories specified by <code>path</code>. 
If no file is found, return an empty matrix.

        <p>If the first argument is a cell array of strings, search each
directory of the loadpath for element of the cell array and return
the first that matches.

        <p>If the second optional argument <code>"all"</code> is supplied, return
a cell array containing the list of all files that have the same
name in the path.  If no files are found, return an empty cell array. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dfile_005fin_005fpath.html#doc_002dfile_005fin_005fpath">file_in_path</a>, <a href="doc_002dpath.html#doc_002dpath">path</a>. 
</p></blockquote></div>

<!-- load-path.cc -->
   <p><a name="doc_002drestoredefaultpath"></a>

<div class="defun">
&mdash; Built-in Function:  <b>restoredefaultpath</b> (<var><small class="dots">...</small></var>)<var><a name="index-restoredefaultpath-633"></a></var><br>
<blockquote><p>Restore Octave's path to it's initial state at startup.

     <!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
     <!-- A simple blank line produces the correct behavior. -->
     <!-- @sp 1 -->
     <p class="noindent"><strong>See also:</strong> <a href="doc_002dpath.html#doc_002dpath">path</a>, <a href="doc_002daddpath.html#doc_002daddpath">addpath</a>, <a href="doc_002drmpath.html#doc_002drmpath">rmpath</a>, <a href="doc_002dgenpath.html#doc_002dgenpath">genpath</a>, <a href="doc_002dpathdef.html#doc_002dpathdef">pathdef</a>, <a href="doc_002dsavepath.html#doc_002dsavepath">savepath</a>, <a href="doc_002dpathsep.html#doc_002dpathsep">pathsep</a>. 
</p></blockquote></div>

<!-- load-path.cc -->
   <p><a name="doc_002dcommand_005fline_005fpath"></a>

<div class="defun">
&mdash; Built-in Function:  <b>command_line_path</b> (<var><small class="dots">...</small></var>)<var><a name="index-command_005fline_005fpath-634"></a></var><br>
<blockquote><p>Return the command line path variable.

     <!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
     <!-- A simple blank line produces the correct behavior. -->
     <!-- @sp 1 -->
     <p class="noindent"><strong>See also:</strong> <a href="doc_002dpath.html#doc_002dpath">path</a>, <a href="doc_002daddpath.html#doc_002daddpath">addpath</a>, <a href="doc_002drmpath.html#doc_002drmpath">rmpath</a>, <a href="doc_002dgenpath.html#doc_002dgenpath">genpath</a>, <a href="doc_002dpathdef.html#doc_002dpathdef">pathdef</a>, <a href="doc_002dsavepath.html#doc_002dsavepath">savepath</a>, <a href="doc_002dpathsep.html#doc_002dpathsep">pathsep</a>. 
</p></blockquote></div>

<!-- utils.cc -->
   <p><a name="doc_002dfind_005fdir_005fin_005fpath"></a>

<div class="defun">
&mdash; Built-in Function:  <b>find_dir_in_path</b> (<var>dir</var>)<var><a name="index-find_005fdir_005fin_005fpath-635"></a></var><br>
<blockquote><p>Return the full name of the path element matching <var>dir</var>.  The
match is performed at the end of each path element.  For example, if
<var>dir</var> is <code>"foo/bar"</code>, it matches the path element
<code>"/some/dir/foo/bar"</code>, but not <code>"/some/dir/foo/bar/baz"</code>
or <code>"/some/dir/allfoo/bar"</code>. 
</p></blockquote></div>

   </body></html>