in-line definition of a function in Scilab language
deff('[s1, s2, ...] = newfunction(e1, e2, ...)',text)
input variables.
output variables.
a matrix of character strings.
deff
can be used to define functions from sequences of instructions
written in text strings. The resulting function object has the same properties
of any other function defined in a text file and loaded with exec
.
![]() | Quotes included in instructions given in strings must be doubled to be protected. |
deff('x = myplus(y,z)', 'x = y+z') myplus(1,%i) deff('[y, z] = mymacro(x)', ['y = 3*x+1'; 'z = a*x + x.^2']) a = 3; [u, v] = mymacro(2) | ![]() | ![]() |
--> deff('x = myplus(y,z)', 'x = y+z') --> myplus(1,%i) ans = 1. + i --> deff('[y, z] = mymacro(x)', ['y = 3*x+1'; 'z = a*x + x.^2']) --> a = 3; --> [u, v] = mymacro(2) v = 10. u = 7.
Version | Description |
6.0.0 |
|