Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.2 - English

Change language to:
Français - 日本語 - Português

Please note that the recommended version of Scilab is 2024.1.0. This page might be outdated.
See the recommended documentation of this function

Scilab help >> Matlab to Scilab Conversion Tips > Matlab-Scilab equivalents > E > eval (Matlab function)

eval (Matlab function)

Execute a string containing an instruction/expression

Matlab/Scilab equivalent

Matlab Scilab
evstr - execstr

Particular cases

Expression:

When eval has to execute an expression then Scilab equivalent for eval is evstr

Instruction:

When eval has to execute an instruction with just one output value then Scilab equivalent for eval is evstr. If instruction has more than one output value then execstr has to be used as follows.

When eval is used with two inputs then an equivalent can be found in examples below.

Examples

Matlab Scilab
eval('1+1')
eval('x=1+1')
eval('[d1,d2]=size(1)')
[d1,d2]=eval('size(1)')
eval('1+1','1+2')
evstr("1+1")
x = evstr("1+1")
execstr("[d1,d2]=size(1)")
execstr("[d1,d2]=size(1)")
if execstr("1+1","errcatch") then execstr("1+2");end
<< etime (Matlab function) E exist (Matlab function) >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu May 12 11:44:29 CEST 2011