Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > b38d2da330d1936e5ab1307c039c4941 > files > 310

octave-doc-3.6.4-3.mga4.noarch.rpm

<html lang="en">
<head>
<title>Inline Functions - GNU Octave</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Octave">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Function-Handles-Inline-Functions-and-Anonymous-Functions.html#Function-Handles-Inline-Functions-and-Anonymous-Functions" title="Function Handles Inline Functions and Anonymous Functions">
<link rel="prev" href="Anonymous-Functions.html#Anonymous-Functions" title="Anonymous Functions">
<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="Inline-Functions"></a>
<p>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Anonymous-Functions.html#Anonymous-Functions">Anonymous Functions</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Function-Handles-Inline-Functions-and-Anonymous-Functions.html#Function-Handles-Inline-Functions-and-Anonymous-Functions">Function Handles Inline Functions and Anonymous Functions</a>
<hr>
</div>

<h4 class="subsection">11.10.3 Inline Functions</h4>

<p>An inline function is created from a string containing the function
body using the <code>inline</code> function.  The following code defines the
function f(x) = x^2 + 2.

<pre class="example">     f = inline("x^2 + 2");
</pre>
   <p class="noindent">After this it is possible to evaluate f at any x by
writing <code>f(x)</code>.

<!-- inline src/ov-fcn-inline.cc -->
   <p><a name="doc_002dinline"></a>

<div class="defun">
&mdash; Built-in Function:  <b>inline</b> (<var>str</var>)<var><a name="index-inline-795"></a></var><br>
&mdash; Built-in Function:  <b>inline</b> (<var>str, arg1, <small class="dots">...</small></var>)<var><a name="index-inline-796"></a></var><br>
&mdash; Built-in Function:  <b>inline</b> (<var>str, n</var>)<var><a name="index-inline-797"></a></var><br>
<blockquote><p>Create an inline function from the character string <var>str</var>. 
If called with a single argument, the arguments of the generated
function are extracted from the function itself.  The generated
function arguments will then be in alphabetical order.  It should
be noted that i, and j are ignored as arguments due to the
ambiguity between their use as a variable or their use as an inbuilt
constant.  All arguments followed by a parenthesis are considered
to be functions.

        <p>If the second and subsequent arguments are character strings,
they are the names of the arguments of the function.

        <p>If the second argument is an integer <var>n</var>, the arguments are
<code>"x"</code>, <code>"P1"</code>, <small class="dots">...</small>, <code>"P</code><var>N</var><code>"</code>. 
<!-- 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_002dargnames.html#doc_002dargnames">argnames</a>, <a href="doc_002dformula.html#doc_002dformula">formula</a>, <a href="doc_002dvectorize.html#doc_002dvectorize">vectorize</a>. 
</p></blockquote></div>

<!-- argnames src/ov-fcn-inline.cc -->
   <p><a name="doc_002dargnames"></a>

<div class="defun">
&mdash; Built-in Function:  <b>argnames</b> (<var>fun</var>)<var><a name="index-argnames-798"></a></var><br>
<blockquote><p>Return a cell array of character strings containing the names of
the arguments of the inline function <var>fun</var>. 
<!-- 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_002dinline.html#doc_002dinline">inline</a>, <a href="doc_002dformula.html#doc_002dformula">formula</a>, <a href="doc_002dvectorize.html#doc_002dvectorize">vectorize</a>. 
</p></blockquote></div>

<!-- formula src/ov-fcn-inline.cc -->
   <p><a name="doc_002dformula"></a>

<div class="defun">
&mdash; Built-in Function:  <b>formula</b> (<var>fun</var>)<var><a name="index-formula-799"></a></var><br>
<blockquote><p>Return a character string representing the inline function <var>fun</var>. 
Note that <code>char (</code><var>fun</var><code>)</code> is equivalent to
<code>formula (</code><var>fun</var><code>)</code>. 
<!-- 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_002dargnames.html#doc_002dargnames">argnames</a>, <a href="doc_002dinline.html#doc_002dinline">inline</a>, <a href="doc_002dvectorize.html#doc_002dvectorize">vectorize</a>. 
</p></blockquote></div>

<!-- symvar scripts/miscellaneous/symvar.m -->
   <p><a name="doc_002dsymvar"></a>

<div class="defun">
&mdash; Function File:  <b>symvar</b> (<var>s</var>)<var><a name="index-symvar-800"></a></var><br>
<blockquote><p>Identify the argument names in the function defined by a string. 
Common constant names such as <code>pi</code>, <code>NaN</code>, <code>Inf</code>,
<code>eps</code>, <code>i</code> or <code>j</code> are ignored.  The arguments that are
found are returned in a cell array of strings.  If no variables are
found then the returned cell array is empty. 
</p></blockquote></div>

   </body></html>