MATLAB Answers

from python to matlab

18 views (last 30 days)
qrqr
qrqr on 1 Aug 2019
Commented: qrqr on 2 Aug 2019
I do not know how to send variables defined in python to MATLAB.
If you define A = 2 in python,
how does A = 2 in the MATLAB workspace Can you move it?

  2 Comments

KSSV
KSSV on 1 Aug 2019
In matlab simple:
A = 2
qrqr
qrqr on 1 Aug 2019
I want to move python variables to MATLAB

Sign in to comment.

Accepted Answer

Wiley Mosley
Wiley Mosley on 2 Aug 2019
Edited: Wiley Mosley on 2 Aug 2019
I believe you would want to utilize the matlab engine. If you are just trying to get the data in a format that you can then call a matlab function there are examples in the above link that should help you out.
You could possibly try sharing the session and maybe then variables in python would appear in the matlab workspace, but I have not tried this before.

  1 Comment

qrqr
qrqr on 2 Aug 2019
Thanks
I entered the following code
cd (fullfile(matlabroot,'extern','engines','python'))
system('python setup.py install')
But,I got the following error
'python' is an internal or external command,
It is not recognized as an operable program or batch file.
Each version is below
MATLAB Ver.2019a
Python Ver.2.7

Sign in to comment.

More Answers (1)

Wiley Mosley
Wiley Mosley on 1 Aug 2019

  1 Comment

qrqr
qrqr on 2 Aug 2019
Thank you
I saw the contents
Pass data from Python to MATLAB
It is written like this, but I do not know because there is no concrete code.
For example, typing 'float' will do something?

Sign in to comment.

Sign in to answer this question.

Tags

Products


Release

R2019a