Sophie

Sophie

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

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

<html lang="en">
<head>
<title>Private Functions - 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="prev" href="Subfunctions.html#Subfunctions" title="Subfunctions">
<link rel="next" href="Overloading-and-Autoloading.html#Overloading-and-Autoloading" title="Overloading and Autoloading">
<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="Private-Functions"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Overloading-and-Autoloading.html#Overloading-and-Autoloading">Overloading and Autoloading</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" 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.3 Private Functions</h4>

<p>In many cases one function needs to access one or more helper
functions.  If the helper function is limited to the scope of a single
function, then subfunctions as discussed above might be used.  However,
if a single helper function is used by more than one function, then
this is no longer possible.  In this case the helper functions might
be placed in a subdirectory, called "private", of the directory in which
the functions needing access to this helper function are found.

   <p>As a simple example, consider a function <code>func1</code>, that calls a helper
function <code>func2</code> to do much of the work.  For example

<pre class="example">     function y = func1 (x)
       y = func2 (x);
     endfunction
</pre>
   <p class="noindent">Then if the path to <code>func1</code> is <code>&lt;directory&gt;/func1.m</code>, and if
<code>func2</code> is found in the directory <code>&lt;directory&gt;/private/func2.m</code>,
then <code>func2</code> is only available for use of the functions, like
<code>func1</code>, that are found in <code>&lt;directory&gt;</code>.

   </body></html>