How to add the path to a local python file to be executed by a Matlab script?
77 次查看(过去 30 天)
显示 更早的评论
Hi,
I want to execute a python function from a Matlab script. How can I add the path to the local python file to be visible to the Matlab script?
Thanks
0 个评论
采纳的回答
更多回答(2 个)
Yongjian Feng
2021-9-12
Python uses an env var called PYTHONPATH to point to packages/scripts. So inside matlab, you just need to add the path you want to that env var following this: set env var
3 个评论
Emil Skoglund
2023-1-14
@Jaime Trivino Was your problem related to python environment ?
I am running my scripts just if I keep them in the current path folder, but when I use addpath() it does not work anymore... Was this the problem you had, if so how did you fix it?
Best,
Emil
Emil Skoglund
2023-1-14
You need to use this function to add the path of the folder istead of the addpath().
https://se.mathworks.com/matlabcentral/fileexchange/62703-py_addpath-directory-matlab_too
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call Python from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!