Hello Nathalie,
It seems you are encountering the "Python not found" issue. To resolve this, please follow the steps outlined below.
Firstly, ensure that the version of Python you are using is compatible with your MATLAB version. You can refer to the following documentation for guidance: https://www.mathworks.com/support/requirements/python-compatibility.html?s_tid=srchtitle_site_search_1_python%20compatibility#:~:text=3.7%2C%203.8%2C%203.9-,R2021a,-2.7%2C%203.7%2C%203.8 .
Next, verify that Python is added to the "Environment Path" variables. If it is not, you can add it by going to the Start Menu, typing "Edit environment variables for your account," and then selecting "Path" under User variables. Click "Edit" and enter the path to your Python executable.
Now, in the MATLAB command window, type the following command:
>> pyenvpyenv( 'Version', 'path_to_python_executable', 'ExecutionMode', 'OutOfProcess');
This command will link Python to MATLAB. To verify whether the linking is successful, type the following command in the MATLAB command window:
>> pyenv
This will display the Python version and the path to the Python executable file.
Ensure that you add the Python file you wish to run to the MATLAB path. This will enable you to successfully execute the Python file using the "system" function call.
To learn more about “pyenv” function, follow the guidelines in this documentation:
Hope it helps!