Import MATLAB package located in different directory

조회 수: 15 (최근 30일)
KATERINE ARIAS . 2021년 10월 28일
답변: Yongjian Feng . 2021년 11월 8일
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")
This is the Python file that imports the MATLAB package...:
from Library.MATLABFUNC import matlabfunction
test_mat= matlabfunction.initialize()
This is the directory of my project
------ matlabfunction (folder generated by Library Compiler)

답변 (1개)

Yongjian Feng
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.


Help CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by