Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matlab in jupyter notebook #5

Open
eliselavy opened this issue Nov 28, 2022 · 3 comments
Open

Matlab in jupyter notebook #5

eliselavy opened this issue Nov 28, 2022 · 3 comments
Assignees

Comments

@eliselavy
Copy link
Collaborator

eliselavy commented Nov 28, 2022

Matlab in jupyter notebook

2 solutions tested:

@eliselavy eliselavy self-assigned this Nov 28, 2022
@eliselavy
Copy link
Collaborator Author

eliselavy commented Nov 28, 2022

Test of the MATLAB Integration for Jupyter has been made:
Project here : https://github.com/mathworks/jupyter-matlab-proxy
=>Enables you to access MATLAB in a web browser from your Jupyter environment.
This package currently, does not provide a kernel level integration with Jupyter. (under active development)

  1. Prerequis: having Matlab installed

⚠️ have the appropriate licence to run the MATLAB Integration for Jupyter
Screenshot 2022-11-28 at 14 25 30

  1. TAKE CARE TO
  • configure properly the path for MATLAB
    Screenshot 2022-11-28 at 11 36 40

For Mac user:
Messages  Show Package Contents

interproces
9-1e368a51acdf.png)
Screenshot 2022-11-28 at 12 00 24

Set bash_profile:

# Setting PATH forMatlab
# The original version is saved in .bash_profile.pysave
PATH="/Applications/MATLAB_R2022b.app/bin/:${PATH}"
export PATH
  1. python -m pip install jupyter-matlab-proxy

Screenshot 2022-11-28 at 14 24 20
This package currently, does not provide a kernel level integration with Jupyter. (under active development)

Screenshot 2022-11-28 at 14 40 26

@eliselavy
Copy link
Collaborator Author

eliselavy commented Nov 28, 2022

TO TEST also: MATLAB Integration for Jupyter in a Docker Container
https://github.com/mathworks-ref-arch/matlab-integration-for-jupyter/tree/main/matlab
The Dockerfile in this repository builds a Docker® image based on jupyter/base-notebook which contains the jupyter-matlab-proxy package and installs MATLAB® using the MATLAB Package Manager (mpm).

The resulting Jupyter environment enables you to start MATLAB in a web browser tab from a Jupyter® notebook.

If you want to install the MATLAB Integration for Jupyter without using Docker, use the installation instructions in the repository MATLAB Integration for Jupyter instead.

@eliselavy
Copy link
Collaborator Author

eliselavy commented Nov 28, 2022

TESTED ALSO: MATLAB kernel for Jupyter
Project here : https://github.com/Calysto/matlab_kernel

Prerequis

  1. Matlab engine for Python

https://fr.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html

Install Using pip
Starting with MATLAB R2022b, you can use the pip command to install the API.

One solution:

  • To install from the MATLAB folder, type:
cd "matlabroot\extern\engines\python"

cd /Applications/MATLAB_R2022b.app/extern/engines/python

python -m pip install .


Other solution:

=> I choose the first solution

⚠️
OSError: MATLAB Engine for Python supports Python version 2.7, 3.8, 3.9, and 3.10, but your version of Python is 3.7

=> upgrade if you are in same case as me

Screenshot 2022-11-28 at 16 04 55

  1. Install the matlab_kernel
    pip install matlab_kernel

  2. Start jupyter notebook

  3. Create notebook with the MATLAB kernel

Screenshot 2022-11-28 at 16 44 45

  1. Insert example
t = linspace(0,6*pi,100);
plot(sin(t))
grid on
hold on
plot(cos(t), 'r')

Screenshot 2022-11-28 at 16 25 40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant