Skip to content
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

Is it possible conserve the workspace between two different calls of the function mlab.run_code() for instance? #23

Closed
crygiova opened this issue Jun 25, 2013 · 4 comments

Comments

@crygiova
Copy link

Hi, I need to generate dynamically a matlab script from python and I would like to use the bridge to send execute my dynamic scripts in Mlab, but I would like to conserve the workspace between two Mlab calls. Is this possible?

@arokem
Copy link
Owner

arokem commented Jun 28, 2013

Sorry for the delay in reply. The answer is yes.

For example, once you have started an instance of the bridge, the following should work:

mlab.run_code("a=1")
# More code doing something else
mlab.run_code("b=a+1") # This is what you meant, right?

@crygiova
Copy link
Author

Thank you! I found it out! But I cannot use it anyway because when I need
to use big matrices in MATLAB I have an error in the open_page method! I
have a badrequest error! I will explain you a bit so you can try to fix it!
I have to make a script that from python query MATLAB and ask to export
some information! If you try to send a request with run_code where inside
you call a MATLAB script that contains for example a plot with a pcolor
(rand(1000,1000)) you will have am error in open_page method! A bad request
even if the MATLAB continue and finish the execution of the script request!
After that the pymatbridge is not working and even if you try to connect
again in the same script it will not work properly! Hope to be useful!
On Jun 29, 2013 1:10 AM, "Ariel Rokem" notifications@github.com wrote:

Sorry for the delay in reply. The answer is yes.

For example, once you have started an instance of the bridge, the
following should work:

mlab.run_code("a=1")

More code doing something else

mlab.run_code("b=a+1") # This is what you meant, right?


Reply to this email directly or view it on GitHubhttps://github.com//issues/23#issuecomment-20219400
.

@arokem
Copy link
Owner

arokem commented Jul 1, 2013

Hmm - interesting. Would you mind posting a minimal example of all the code
you ran and caused this issue?

Thanks !

On Sat, Jun 29, 2013 at 6:12 PM, crygiova notifications@github.com wrote:

Thank you! I found it out! But I cannot use it anyway because when I need
to use big matrices in MATLAB I have an error in the open_page method! I
have a badrequest error! I will explain you a bit so you can try to fix
it!
I have to make a script that from python query MATLAB and ask to export
some information! If you try to send a request with run_code where inside
you call a MATLAB script that contains for example a plot with a pcolor
(rand(1000,1000)) you will have am error in open_page method! A bad
request
even if the MATLAB continue and finish the execution of the script
request!
After that the pymatbridge is not working and even if you try to connect
again in the same script it will not work properly! Hope to be useful!
On Jun 29, 2013 1:10 AM, "Ariel Rokem" notifications@github.com wrote:

Sorry for the delay in reply. The answer is yes.

For example, once you have started an instance of the bridge, the
following should work:

mlab.run_code("a=1")

More code doing something else

mlab.run_code("b=a+1") # This is what you meant, right?


Reply to this email directly or view it on GitHub<
https://github.com/arokem/python-matlab-bridge/issues/23#issuecomment-20219400>

.


Reply to this email directly or view it on GitHubhttps://github.com//issues/23#issuecomment-20225144
.

@crygiova
Copy link
Author

crygiova commented Jul 1, 2013

Hi

I made up an example that give me exactly the same error of my script.

If you can let me know some informations when you try it, it will be very
useful!

2013/7/1 Ariel Rokem notifications@github.com

Hmm - interesting. Would you mind posting a minimal example of all the
code
you ran and caused this issue?

Thanks !

On Sat, Jun 29, 2013 at 6:12 PM, crygiova notifications@github.com
wrote:

Thank you! I found it out! But I cannot use it anyway because when I
need
to use big matrices in MATLAB I have an error in the open_page method! I
have a badrequest error! I will explain you a bit so you can try to fix
it!
I have to make a script that from python query MATLAB and ask to export
some information! If you try to send a request with run_code where
inside
you call a MATLAB script that contains for example a plot with a pcolor
(rand(1000,1000)) you will have am error in open_page method! A bad
request
even if the MATLAB continue and finish the execution of the script
request!
After that the pymatbridge is not working and even if you try to connect
again in the same script it will not work properly! Hope to be useful!
On Jun 29, 2013 1:10 AM, "Ariel Rokem" notifications@github.com
wrote:

Sorry for the delay in reply. The answer is yes.

For example, once you have started an instance of the bridge, the
following should work:

mlab.run_code("a=1")

More code doing something else

mlab.run_code("b=a+1") # This is what you meant, right?


Reply to this email directly or view it on GitHub<

https://github.com/arokem/python-matlab-bridge/issues/23#issuecomment-20219400>

.


Reply to this email directly or view it on GitHub<
https://github.com/arokem/python-matlab-bridge/issues/23#issuecomment-20225144>

.


Reply to this email directly or view it on GitHubhttps://github.com//issues/23#issuecomment-20259423
.

@arokem arokem closed this as completed Aug 22, 2013
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

2 participants