gpeyre / numerical-tours

Numerical Tours of Signal Processing

Home Page:http://www.numerical-tours.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Indicating matlab binaries to pymatbridge

gpeyre opened this issue · comments

When I run %load_ext pymatbridge for the first time after launching ipython notebook, it fails to start MATLAB on ZMQ socket.

However, running a cell with

from pymatbridge import Matlab
mlab = Matlab()
mlab = Matlab(executable='/Applications/MATLAB_R2013b.app/bin/matlab')
mlab.start()

succeeds. And then, if I restart the ipython kernel (or start another notebook), %load_ext pymatbridge is now working. Apparently, it seems that one needs to explictely tells where is the Matlab executable, and then pymatbridge remembers it unless the whole ipython notebook is re-launched.

Can you try adding matlab to your system PATH variable and trying again? If that works, I'll add that to the installation instructions.

Indeed, this does the trick, thanks!

Regarding installation instructions, I was thinking it would be easier to simply update a readme.md file (and also include some explanation that people needs to download the toolboxes and put it somewhere in their path), and making a reference to this readme at the beginning of each tour.

We could add a readme.html and link to it from each of the notebooks. That way it is is rendered locally and online. We link to it as "please view the [readme](readme.html)".

We can also include more detailed instructions about the PATH handling like what I did for oct2py.

I think this is a very good idea indeed.

Perhaps this page belongs on the gh-pages site? Here is a start on the text for the matlab notebooks:


Installation
------------
You need to download [numerical_tours][1]
and install the IPython [notebook][2] to run the code.

You must also install the [python-matlab-bridge][3].

Make sure you can run the command `matlab` from a command window
(or terminal).  If not, try the methods below:

__Unix-like-systems (including OSX):__

Add the following to your `~/.profile`: 

`export PATH="$PATH:<PATH_TO_MATLAB>"`

__Windows systems:__

From a CMD window: 

`> setx PATH "%PATH%;C:\PATH_TO_MATLAB.EXE"`

Note, if you see the message: 

"WARNING: The data being saved is truncated to 1024 characters" 

It means your PATH variable is too long. You'll have to manually trim in in the Windows Environmental Variables editor.

[1]: https://github.com/gpeyre/numerical-tours/archive/master.zip
[2]: http://ipython.org/install.html
[3]: http://arokem.github.io/python-matlab-bridge/

I did the modification and added an installation page for matlab and one for python.

I have also modify the installation instruction at the start of the python tours, but not yet at the start of the matlab tours (to many to modify, will do it later).

Of course, you can modify it if needed.

Hold off on the hand-edits. I'll write a script to modify the notebooks in-place.

The introductions are updated.