- Scilab Help
- Strings
- ascii
- asciimat
- blanks
- char
- convstr
- emptystr
- eval
- evstr
- grep
- isalphanum
- isascii
- isdigit
- isletter
- isnum
- justify
- length
- part
- prettyprint
- regexp
- sci2exp
- strcat
- strchr
- strcmp
- strcmpi
- strcspn
- strindex
- string
- strings
- stripblanks
- strncpy
- strrchr
- strrev
- strsplit
- strspn
- strstr
- strsubst
- strtod
- strtok
- tokenpos
- tokens
Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function
evstr
evaluates Scilab expressions and concatenates their results
Syntax
H = evstr(M) H = evstr(list(M, subExpr)) [H, ierr] = evstr(..)
Arguments
- M
single or vector or matrix of character strings: Scilab expressions to be evaluated and results to be concatenated.
- subExpr
vector of character strings: sub-expressions to be pre-evaluated, defining quantities used in
M
expressions.- H
single element, vector, or matrix of concatenated results.
- ierr
an integer, error indicator.
Description
Evaluates expressions set in M
. Then, concatenates their results
to build H
.
All expressions are assumed to yield results of compatible types and sizes with respect to their concatenation.
If the evaluation of M
expressions or the concatenation of their
results leads to an error, H = evstr(M)
yields the error as usual.
To avoid stopping to run next Scilab instructions,
[H, ierr] = evstr(M)
can be used to catch the error.
H
is then set to []
and ierr
returns 999
or another non-null positive code.
If M
is provided through a list, Scilab expressions set in
subExpr
are evaluated before evaluating M
.
The results of these subexpressions must be referred to as %(k)
in M
, where k
is the subexpression's index in
subExpr
.
|
Special aliases:
|
Examples
a = 1; b = 2; Z = ['a', 'b'] ; evstr(Z) Z = list(['%(1)','%(1)-%(2)'],['a+1','b+1']); evstr(Z) evstr('NaN'), evstr('Inf') //The two return values version [H, ierr] = evstr(Z) // no error Z = ['a', 'b', 'c'] ;// the variable c is undefined [H, ierr] = evstr(Z) // error 4: Undefined variable: c
See also
- execstr — execute Scilab code in strings
- sci2exp — returns a string able to generate a given Scilab object
- strtod — parse and convert literal numbers STRings TO Decimal numbers
- concatenation — Concatenation. Recipients of an assignment. Results of a function
History
Version | Description |
5.3.0 | "Nan" and "NaN" are now parsed as %nan .
"Inf" and "INF" are now parsed as %inf . |
6.0.1 | Simple comments are now supported in almost all possible input expressions,
whatever is the shape of M . |
Report an issue | ||
<< eval | Strings | grep >> |