- 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
evaluation of expressions
Syntax
H = evstr(Z) [H, ierr] = evstr(Z)
Arguments
- Z
a matrix of character strings
M
orlist(M,Subexp)
- M
a matrix of character strings.
- Subexp
a vector of character strings.
- H
a matrix.
- ierr
an integer, error indicator.
Description
Returns the result of the evaluation of the matrix of character
strings M
. Each element of the matrix must define a
valid Scilab expression.
If the evaluation of M
expression leads to an
error, the single return value version, H = evstr(M)
,
raises the error as usual. The two return values version,
[H,ierr] = evstr(M)
, on the other hand, produces no
error, but returns the error number in ierr
.
If Z
is a list, Subexp
is a
vector of character strings, that defines subexpressions which are
evaluated before evaluating M
. These subexpressions
must be referred to as %(k)
in M
,
where k
is the subexpression's index in
Subexp
.
evstr('a = 1')
is not valid (use execstr
instead).
Nan
, NaN
will be interpreted as %nan
.
Inf
will be interpreted as %inf
.
Note that Z should not be composed of continuation marks (..). |
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
Report an issue | ||
<< eval | Strings | grep >> |