1 <?xml version="1.0" encoding="UTF-8"?>
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
5 * Copyright (C) 2017 - 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:ns5="http://www.w3.org/1999/xhtml"
19 xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"
20 xmlns:scilab="http://www.scilab.org" xml:id="evstr" xml:lang="en">
22 <refname>evstr</refname>
23 <refpurpose>evaluates Scilab expressions and concatenates their results</refpurpose>
29 H = evstr(list(M, subExpr))
34 <title>Arguments</title>
40 single or vector or matrix of character strings: Scilab expressions to be
41 evaluated and results to be concatenated.
49 vector of character strings: sub-expressions to be pre-evaluated, defining
50 quantities used in <literal>M</literal> expressions.
58 single element, vector, or matrix of concatenated results.
65 <para>an integer, error indicator.</para>
71 <title>Description</title>
73 Evaluates expressions set in <varname>M</varname>. Then, concatenates their results
74 to build <varname>H</varname>.
77 All expressions are assumed to yield results of compatible types and sizes with respect
78 to their concatenation.
81 If the evaluation of <varname>M</varname> expressions or the concatenation of their
82 results leads to an error, <literal>H = evstr(M)</literal> yields the error as usual.
83 To avoid stopping to run next Scilab instructions,
84 <literal>[H, ierr] = evstr(M)</literal> can be used to catch the error.
85 <varname>H</varname> is then set to <literal>[]</literal> and <varname>ierr</varname>
86 returns <literal>999</literal> or another non-null positive code.
89 If <varname>M</varname> is provided through a list, Scilab expressions set in
90 <varname>subExpr</varname> are evaluated before evaluating <varname>M</varname>.
91 The results of these subexpressions must be referred to as <literal>%(k)</literal>
92 in <varname>M</varname>, where <literal>k</literal> is the subexpression's index in
93 <varname>subExpr</varname>.
99 Assignments like <literal>"a = 1"</literal> are not accepted as expressions,
100 neither in <varname>M</varname> nor in <varname>subExpr</varname>.
101 <function>execstr</function> must be used instead to evaluate such expressions.
106 Continuation marks <literal>".."</literal> are forbidden in expressions
107 in <varname>M</varname> as well as in <varname>subExpr</varname>.
112 <note>Special aliases:
115 <literal>"Nan"</literal> and <literal>"NaN"</literal> are parsed as
116 <constant>%nan</constant>.
119 <literal>"Inf"</literal> and <literal>"INF"</literal> are parsed as
120 <constant>%inf</constant>.
126 <title>Examples</title>
127 <programlisting role="example"><![CDATA[
132 Z = list(['%(1)','%(1)-%(2)'],['a+1','b+1']);
135 evstr('NaN'), evstr('Inf')
137 //The two return values version
138 [H, ierr] = evstr(Z) // no error
139 Z = ['a', 'b', 'c'] ;// the variable c is undefined
140 [H, ierr] = evstr(Z) // error 4: Undefined variable: c
141 ]]> </programlisting>
143 <refsection role="see also">
144 <title>See also</title>
145 <simplelist type="inline">
147 <link linkend="execstr">execstr</link>
150 <link linkend="sci2exp">sci2exp</link>
153 <link linkend="strtod">strtod</link>
156 <link linkend="brackets">concatenation</link>
160 <refsection role="history">
161 <title>History</title>
164 <revnumber>5.3.0</revnumber>
166 <literal>"Nan"</literal> and <literal>"NaN"</literal> are now parsed as <literal>%nan</literal>.
167 <literal>"Inf"</literal> and <literal>"INF"</literal> are now parsed as <literal>%inf</literal>.
171 <revnumber>6.0.1</revnumber>
173 Simple comments are now supported in almost all possible input expressions,
174 whatever is the shape of <literal>M</literal>.