mrkrd / matlab_wrapper

Easy to use MATLAB wrapper for Python
GNU General Public License v3.0
78 stars 23 forks source link

Access an already running Matlab session #25

Closed sebitoelcheater closed 6 years ago

sebitoelcheater commented 6 years ago

In Matlab exists the Shared Sessions. If there is one shared session running, one should access to it instead of always creating a new one.

https://www.mathworks.com/help/matlab/matlab_external/attaching-to-an-existing-matlab-session.html

mrkrd commented 6 years ago

In Matlab exists the Shared Sessions. If there is one shared session running, one should access to it instead of always creating a new one.

Could you be more specific? Why do you say that one should access a shared session? Is there a C API for that?

sebitoelcheater commented 6 years ago

In my case, I need to access the session that some users are already working on. I can't ask them to stop their work and use a session I will open for them. It's an already implemented functionality in the oficial Matlab API for Python, connect_matlab that receives the name of the shared session that is being tried to access (there is also a way to list all the shared Matlab sessions in a computer). I'm using that, however it would be great to have that implemented on this project.

mrkrd commented 6 years ago

In my case, I need to access the session that some users are already working on. I can't ask them to stop their work and use the lesson I will open for them. It's an already implemented functionality in the oficial Matlab API for Python, connect_matlan that receives the name of the shared session that is being tried to access (there is also a way to list all the shared Matlab sessions in a computer).

OK, I see. My suggestions are (sorted by "easiness"):

  1. Use the official Python package, if it does what you need.

  2. I've never used the shared sessions, but maybe it's enough to add a command line option when starting MATLAB (?). If that the case then matlab_wrapper.MatlabSession has an argument to pass options when starting a MATLAB process.

  3. If possible, you could also implement this functionality in matlab_wrapper and open a PR.

mrkrd commented 6 years ago

I don't think it's possible to implement this feature using MATLAB's C API.