1 <?xml version="1.0" encoding="UTF-8"?>
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
5 * Copyright (C) 2012 - 2016 - Scilab Enterprises
7 * This file is hereby licensed under the terms of the GNU GPL v2.0,
8 * pursuant to article 5.3.4 of the CeCILL v.2.1.
9 * This file was originally licensed under the terms of the CeCILL v2.1,
10 * and continues to be available under such terms.
11 * For more information, see the COPYING file which you should have received
12 * along with this program.
15 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
16 xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml"
17 xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"
18 xmlns:scilab="http://www.scilab.org" xml:id="evstr" xml:lang="en">
20 <refname>evstr</refname>
21 <refpurpose>evaluation of expressions</refpurpose>
31 <title>Arguments</title>
37 a matrix of character strings <varname>M</varname> or
38 <code>list(M,Subexp)</code>
44 <para>a matrix of character strings.</para>
50 <para>a vector of character strings.</para>
59 <para>a matrix.</para>
65 <para>an integer, error indicator.</para>
71 <title>Description</title>
73 Returns the result of the evaluation of the matrix of character
74 strings <varname>M</varname>. Each element of the matrix must define a
75 valid Scilab expression.
78 If the evaluation of <varname>M</varname> expression leads to an
79 error, the single return value version, <code>H = evstr(M)</code>,
80 raises the error as usual. The two return values version,
81 <code>[H,ierr] = evstr(M)</code>, on the other hand, produces no
82 error, but returns the error number in <varname>ierr</varname>.
85 If <varname>Z</varname> is a list, <varname>Subexp</varname> is a
86 vector of character strings, that defines subexpressions which are
87 evaluated before evaluating <varname>M</varname>. These subexpressions
88 must be referred to as <literal>%(k)</literal> in <varname>M</varname>,
89 where <literal>k</literal> is the subexpression's index in
90 <varname>Subexp</varname>.
93 <code>evstr('a = 1')</code> is not valid (use <function>execstr</function>
97 <literal>Nan</literal>, <literal>NaN</literal> will be interpreted as <constant>%nan</constant>.
100 <literal>Inf</literal> will be interpreted as <constant>%inf</constant>.
103 <varname>Z</varname> should not include any continuation marks (..).
107 <title>Examples</title>
108 <programlisting role="example"><![CDATA[
113 Z = list(['%(1)','%(1)-%(2)'],['a+1','b+1']);
116 evstr('NaN'), evstr('Inf')
118 //The two return values version
119 [H, ierr] = evstr(Z) // no error
120 Z = ['a', 'b', 'c'] ;// the variable c is undefined
121 [H, ierr] = evstr(Z) // error 4: Undefined variable: c
122 ]]> </programlisting>
124 <refsection role="see also">
125 <title>See also</title>
126 <simplelist type="inline">
128 <link linkend="execstr">execstr</link>