execstrexecute Scilab code in stringsCalling Sequenceexecstr(instr)
ierr = execstr(instr,'errcatch' [,msg])
Argumentsinstra vector of character strings, Scilab instruction to be executed.ierran integer, 0 or error number.msg
a character string with values 'm' or 'n'. Default value is 'n'.
DescriptionExecutes the Scilab instructions given in argument
instr.
Note that instr should not make use of continuation marks (..)
If the 'errcatch' flag is not present, error handling works as usual.
If the 'errcatch' flag is set, and an error is encountered while
executing the instructions defined in instr, execstr
issues no error message, but aborts execution of the instr
instructions (at the point where the error occurred), and resumes with
ierr equal to the error number. In this case the display of the
error message is controlled by the msg option:
"m"error message is displayed and recorded."n"
no error message is displayed, but the error message is recorded (see lasterror). This is the default.
ierr = execstr(instr, 'errcatch') can handle syntactical errors. This is
useful for evaluation of instruction obtained by a query to the user.
Examples0 then
disp("Trigger an error");
else
disp("execstr is happy");
end
// variable2 exists ... no error is triggered by execstr
variable2=[2,3];
if execstr('variable2;','errcatch')<>0 then
disp("Trigger an error");
else
disp("execstr is happy");
end
]]>See Also
evstr
lasterror
error
try