Main Content
pyrunfile
Syntax
Description
pyrunfile(
executes the Python statements with input arguments. Python scripts read command-line arguments as strings.file input
)
executes the code with one or more name-value pair arguments.outvars
= pyrunfile(file
,outputs
,pyName=pyValue
)
Examples
Input Arguments
Output Arguments
Limitations
Python classes defined using
pyrun
orpyrunfile
cannot 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
pyrun
andpyrunfile
functions 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 thepy.
prefix.
Version History
Introduced in R2021b