问题
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:
- Download and install Anaconda.
- Install the Python packages
pymatbridgeandmatlab_kernel. 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.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