Open a59 opened 9 years ago
This might actually be a bug.
You should be able to execute arbitrary MATLAB code using the %matlab
magic once the extension is loaded, meaning that using
%matlab exit
or
%%matlab
exit
should work. However, currently, these commands both cause my iPython notebook to hang forever (>60s).
I assume this is because pymatbridge is waiting for a ZMQ response that never comes (by definition, since MATLAB has shut down?)
Sorry @a59 for slow response here. I am not sure I understand the problem. Were you able to use the pymatbridge after initializing it?
As for @brunobeltran - I think that this is just a confusion. There are actually two kinds of exit
: one is the matlab function exit
. The other is a message that can be sent to the ZMQ server:
https://github.com/arokem/python-matlab-bridge/blob/master/pymatbridge/messenger/src/messenger.c#L45
And would terminate the messenger. We might want to provide a more elegant message here, though.
Yeah, you're right, I was simply confused before.
@a59 I think the short answer to your question is: to close Matlab when using the "magics" form of pymatbridge, simply unload the extension. Matlab will be closed automagically.
I was able to get
%load_ext pymatbridge
to work. But it returns
Starting MATLAB on ZMQ socket ipc:///tmp/pymatbridge-5bb9f445-7224-463d-8e98-b505faf751d3 Send 'exit' command to kill the server
Do I need to send an 'exit' command and if so, how do I do that?
I was unable to find instructions for this anywhere in the documentation.