1 <?xml version="1.0" encoding="UTF-8"?>
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) XXXX-2008 - INRIA
5 * Copyright (C) 2018 - Samuel GOUGEON
7 * Copyright (C) 2012 - 2016 - Scilab Enterprises
9 * This file is hereby licensed under the terms of the GNU GPL v2.0,
10 * pursuant to article 5.3.4 of the CeCILL v.2.1.
11 * This file was originally licensed under the terms of the CeCILL v2.1,
12 * and continues to be available under such terms.
13 * For more information, see the COPYING file which you should have received
14 * along with this program.
17 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
18 xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
19 xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
20 xml:lang="en" xml:id="deff">
22 <refname>deff</refname>
23 <refpurpose>in-line definition of a function in Scilab language</refpurpose>
27 <synopsis>deff('[s1, s2, ...] = newfunction(e1, e2, ...)',text)</synopsis>
30 <title>Arguments</title>
33 <term>e1, e2, ...</term>
35 <para>input variables.</para>
39 <term>s1, s2, ...</term>
41 <para>output variables.</para>
47 <para>a matrix of character strings.</para>
53 <title>Description</title>
55 <function>deff</function> can be used to define functions from sequences of instructions
56 written in text strings. The resulting function object has the same properties
57 of any other function defined in a text file and loaded with <function>exec</function>.
60 Quotes included in instructions given in strings must be doubled to be protected.
64 <title>Examples</title>
65 <programlisting role="example"><![CDATA[
66 deff('x = myplus(y,z)', 'x = y+z')
69 deff('[y, z] = mymacro(x)', ['y = 3*x+1'; 'z = a*x + x.^2'])
74 --> deff('x = myplus(y,z)', 'x = y+z')
79 --> deff('[y, z] = mymacro(x)', ['y = 3*x+1'; 'z = a*x + x.^2'])
81 --> [u, v] = mymacro(2)
89 <refsection role="see also">
90 <title>See also</title>
91 <simplelist type="inline">
93 <link linkend="function">function</link>
96 <link linkend="exec">exec</link>
99 <link linkend="getd">getd</link>
102 <link linkend="genlib">genlib</link>
105 <link linkend="jdeff">jdeff</link>
108 <link linkend="jcompile">jcompile</link>
112 <refsection role="history">
113 <title>History</title>
116 <revnumber>6.0.0</revnumber>
121 <ulink url="https://help.scilab.org/docs/5.5.2/en_US/deff.html">
122 <varname>opt="c"|"p"|"n"</varname>
123 </ulink> is no longer available.
126 The defined <varname>newfunction</varname> is now of type 13 (instead of 11).