matlab python engine module not recognized
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am having trouble using the matlab python engine. I tried this piece of code from the mathworks website:
import matlab.engine
if __name__ == '__main__':
eng = matlab.engine.start_matlab()
x = 4.0
eng.workspace['y'] = x
a = eng.eval('sqrt(y)')
print(a)
pass
But pycharm is giving me an error saying "ModuleNotFoundError: No module named 'matlab.engine'; 'matlab' is not a package". I am using python 3.6 and matlab 2018. I saw that these are the supported versions on website, I saw a similar post about this problem but I can't even run my program from python command line. I also can't find teh matlab.py in my python site-packages, although I have the matlab folder in packages.
0 Kommentare
Antworten (1)
Meet
am 17 Jan. 2025
Hi Shiping,
To resolve this issue, you need to install the MATLAB Engine API for Python:
First ensure that you have correct version of python installed and accessible using command line.
Then open a command prompt and navigate to the MATLAB engine directory:
cd "matlabroot\extern\engines\python"
Replace 'matlabroot' with your MATLAB installation directory.
Install MATLAB API using 'pip' command:
python -m pip install .
To get the detailed instructions on the same, please follow this documentation link:
0 Kommentare
Siehe auch
Kategorien
Mehr zu Call MATLAB from Python finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!