pyrun
Description
pyrun( executes the Python® statements in code)code in the Python interpreter.
Variables created using the pyrun function are persistent. You can
        use these variables in subsequent calls to pyrun.
outvars = pyrun(code,outputs,pyName=pyValue)
Examples
Input Arguments
Output Arguments
Limitations
- Python classes defined using - pyrunor- pyrunfilecannot be modified if you return an instance of the class to MATLAB. If you need to change class definitions, restart the interpreter session:- terminate(pyenv) pyenv(ExecutionMode="OutOfProcess") - Alternatively, restart MATLAB for - "InProcess".- The - pyrunand- pyrunfilefunctions do not support classes with local variables that are initialized by other local variables through methods. For such usage, create a module and access it using the- py.prefix.
- Type conversion based on Python type hints is not supported for - pyrun,- pyrunfileor the Run Python Code task where native Python code is provided as input.
Version History
Introduced in R2021b