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

Use the output of ipython in a variable #47

Closed
garikoitz opened this issue Feb 9, 2014 · 2 comments
Closed

Use the output of ipython in a variable #47

garikoitz opened this issue Feb 9, 2014 · 2 comments

Comments

@garikoitz
Copy link

Hi, is this possible?
I need to run some code in Matlab and then read the output which is only one number. I don't want to bring and brought back all the structures from Matlab.
When I use the iPython option I can see the correct answer (ans = ) in the iPython console, but I don't know how to use it in a variable.

thanks for the project!
Gari

@haoxingz
Copy link
Collaborator

Hi Gari,

Yes you can do this. Assuming you want to store the result in Python as "res_py", and this number is stored in Matlab as "res_mat", you can use the following cell magic command to retrieve the number:

%%matlab -o res_py
res_py = res_mat;

@blink1073
Copy link
Collaborator

Closing as answered. Feel free to reopen @garikoitz if you disagree.

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

3 participants