Import MATLAB package located in different directory
2 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I have a simple function compiled with "Library Compiler" in MATLAB but I don't know how to import it from python when the package doesn't have to be in the same directory as the calling Python function. However, when I place the MATLAB package in the same directory as the Python script it does work. (I already did the install process: "python setup.py")
This is the Python file that imports the MATLAB package...:
python_script.py
from Library.MATLABFUNC import matlabfunction
test_mat= matlabfunction.initialize()
test_mat.function(nargout=0)
This is the directory of my project
Run_folder
---- python_script.py
Library
---- MATLABFUNC
------ matlabfunction (folder generated by Library Compiler)
0 件のコメント
回答 (1 件)
Yongjian Feng
2021 年 11 月 8 日
I think it is similar to this answer. Basically you need to set the env var PYTHONPATH to include the location of that python package.
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!