pyrun(code)
outvars = pyrun(code, outputs)
outvars = pyrun(code, outputs, pyName, pyValue)
| Parameter | Description |
|---|---|
| code | a string scalar, string array, character vector, character array or python code object. |
| pyName, pyValue | Input arguments name and value |
| outputs | string array: Python variable names. |
| Parameter | Description |
|---|---|
| outvars | One or more Nelson workspace variable names returned as valid Python types. |
pyrun(code) function executes Python statements present in the code string within the Python interpreter.
Variables generated by the pyrun function remain persistent, allowing their usage in subsequent pyrun calls.
outvars = pyrun(code, outputs) Python variables specified in outputs are returned to Nelson.
The values of these variables are captured in outvars.
outvars = pyrun(code, outputs, pyName, pyValue), the code is executed with assigned input and output variable names using Nelson data passed through one or more name-value arguments.
pyrun('a = b * c', 'b', 5, 'c', 10)
r = pyrun('d = a + c', 'd')
pyrun(["a = 3","print(a)"])
[R1, R2] = pyrun("a=b*c",["a","b"], 'b', 5, 'c', 10)
PYCODE = pyrun('X = compile(''Y = 3'', ''test'', ''exec'')', 'X')
y = pyrun(PYCODE, 'Y')
| Version | Description |
|---|---|
| 1.3.0 | initial version |
| 1.4.0 | Python code object allowed as first input argument |