Point Kernel for Jupyter Notebook at Matlab

◇◆丶佛笑我妖孽 提交于 2019-12-24 09:08:09

问题


I am trying to get Jupyter Notebook to work with Matlab. I found a very helpful blog post about this which got me as far as being able to create a MATLAB notebook. The blog post proposes the following steps:

  1. Download and install Anaconda.
  2. Install the Python packages pymatbridge and matlab_kernel.
  3. Define the path to the MATLAB executable by typing the following in a terminal:

    echo "export MATLAB_EXECUTABLE=/Applications/MATLAB_2015b.app/bin/matlab" >> ~/.bash_profile.
    
  4. Restart terminal. Then using MATLAB from a Jupyter Notebook should work.

My issue is with the third step, which is to point the kernel to the MATLAB executable. It is written for someone using a Mac, and I am on Windows 10. I'm not familiar enough with what is being done here to "translate" this step for Windows. Here are the instructions for a Mac:

I would deeply appreciate any suggestions on how to accomplish this step in Windows 10.


回答1:


Executing the command

 echo "export MATLAB_EXECUTABLE=/Applications/MATLAB_2015b.app/bin/matlab" >> ~/.bash_profile

in the terminal appends the text

export MATLAB_EXECUTABLE=/Applications/MATLAB_2015b.app/bin/matlab

to the file ~/.bash_profile. This file is loaded every time you open a terminal on OS X. The export command is used to create an environment variable. So with this command, the environment variable MATLAB_EXECUTABLE is created and has the value /Applications/MATLAB_2015b.app/bin/matlab.

This environment variable is needed by the matlab_kernel module, as described in its documentation.

To set an environment variable on Windows (7+), you can use the setx command, as described in this question on SuperUser. Thus, instead of the echo ... line, you should call

setx MATLAB_EXECUTABLE "C:\Program Files (x86)\MATLAB\R2015b\bin\matlab.exe"

Note that you'll need admin rights for that.



来源:https://stackoverflow.com/questions/41214871/point-kernel-for-jupyter-notebook-at-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!