Skip to content

SteenMoeller/friendly-journey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

friendly-journey

Example project to call Matlab using the Python Matlab module.

Python Environment Setup

Prerequisites

  • Python 3.11
$ which python3.11
/bin/python3.11
  • Matlab 2023b
$ ls /opt/cmrr/software/matlab2023b/bin/matlab
/opt/cmrr/software/matlab2023b/bin/matlab

Create and Activate Virtual Environment

export ENV_NAME=friendlyenv
$ python3.11 -m venv ${ENV_NAME}  # This may take a couple minutes
$ source {$ENV_NAME}/bin/activate

Install Matlab Engine

(friendlyenv) $ cd /opt/cmrr/software/matlab2023b/extern/engines/python
(friendlyenv) $ python setup.py build --build-base="${HOME}/${ENV_NAME}"
(friendlyenv) $ ln -s ${HOME}/${ENV_NAME}/lib/matlab ${HOME}/${ENV_NAME}/lib/python3.11/site-packages

Test Matlab Engine

(friendlyenv) $ python
Python 3.11.11 (main, Feb 10 2025, 00:00:00) [GCC 11.5.0 20240719 (Red Hat 11.5.0-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matlab.engine
>>>

Test a Python Script

(friendlyenv) $python -i friendly-journy.py
Starting Matlab engine
<class 'int'>
<class 'matlab.engine.matlabengine.MatlabEngine'>
>>> 

About

Example project to call Matlab using the Python Matlab module.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages