-------------------------- MATLAB kernel for Jupyter -------------------------- To run MATLAB code within Jupyter notebooks, set up the MATLAB kernel in your environment. Prerequisites ============= - Ensure you have **MATLAB R2025b** installed (required for Python 3.12+ compatibility). - Your conda environment should be using **Python 3.12**. Installation steps ================== 1. Activate your environment: .. code-block:: bash conda activate neurowaves-lab-documentation 2. Install Jupyter and the MATLAB kernel: .. code-block:: bash conda install notebook jupyter_client pip install matlab_kernel 3. Install the MATLAB Engine for Python. Navigate to your MATLAB installation folder (for example ``C:\Program Files\MATLAB\R2025b\extern\engines\python``) and install the engine: .. code-block:: bash cd "C:\Program Files\MATLAB\R2025b\extern\engines\python" python -m pip install . Using the kernels ================= Two kernels are available in Jupyter: - **Matlab**: starts a new, independent MATLAB session for the notebook. - **Matlab (Connection)**: connects to an already running MATLAB instance, allowing you to share the workspace. To use the **Connection** kernel: 1. In your standalone MATLAB command window, run: .. code-block:: matlab matlab.engine.shareEngine 2. In Jupyter, select the **Matlab (Connection)** kernel. You can now access variables from your standalone MATLAB session using commands like ``who`` or simply by typing the variable name.