Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Connect to an already running Matlab instance instead of making one #196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
auxiliary opened this issue May 23, 2015 · 7 comments
Open

Comments

@auxiliary
Copy link
Contributor

I think it would be really useful if there could be an option to not call _run_server and instead take an address from the user and connect to an already running Matlab instance. This way all the cool features like the messenger, json, variable conversions, etc. can happen while also providing the flexibility needed for complicated use cases.

@mmagnuski
Copy link

+1

@brunobeltran
Copy link
Contributor

Any plans on jumping on this one @arokem ? If not I could try to see if I can make a dent in it this weekend. Any pointers on where I should get started?

@brunobeltran
Copy link
Contributor

Based on the way that I understand that the transport is currently handled through ZeroMQ, we would need some kind of MATLAB script, more or less equivalent to matlabserver.m that would accept messages in a loop. I see nothing wrong with requiring the user to manually execute this script before they connect pymatbridge. They are allowing the thing complete control over their matlab session, after all. Then, the user could simply Ctrl-C in their Matlab window to regain control at any point. Does this sound like the interface you had in mind @auxiliary ? Note that, as far as I can tell from scanning the code base quickly, there does not seem to be a way in the current framework to simultaneously be sending commands to MATLAB with ZeroMQ while typing separate commands into Matlab (for the same reason that you can't use the terminal interface after starting matlab with -nodesktop and then typing `desktop).

@arokem
Copy link
Owner

arokem commented Aug 21, 2015

No plans to jump on this (sorry - too busy with a host of other things), so feel free to look into it. I think that you could separate up the operations that happen under start, to not start up the server. Around here: https://github.com/arokem/python-matlab-bridge/blob/master/pymatbridge/pymatbridge.py#L202. If you do that, you might be able to separately fire up matlab and connect to it.

@auxiliary
Copy link
Contributor Author

@brunobeltran Sorry for my late response on this. As far as I remember, I ended up doing something like what @arokem suggested and changed the start function and added a flag and some parameters.

This way we could send in an address and start would bind to the address and act as a server. Or in some cases the other way round, as a client depending on the use case. This might make it a little tricky because it would depend on the use case. For example in my case I needed a matlab session to initiate a connection to python.
The project I was working on kinda drifted into something completely different but hopefully I might find the time and be able to clean that part a little and make a pull request.

@brunobeltran
Copy link
Contributor

@auxiliary I have an open pull request that does (probably) the same thing already, just FYI.

@auxiliary
Copy link
Contributor Author

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants