How to create matlab workspace in python

6 visualizaciones (últimos 30 días)
yu  tang cheng
yu tang cheng el 17 de Mzo. de 2021
Respondida: Hans-Joachim Steinort el 1 de Sept. de 2021
like this
I want to use python to create d=2 and in the workspace
Thanks!

Respuestas (2)

Hans-Joachim Steinort
Hans-Joachim Steinort el 1 de Sept. de 2021
In your python file it looks for example like:
import matlab.engine
eng = matlab.engine.start_matlab()
eng.workspace['yourVar1'] = 1
eng.workspace['yourVar2'] = 'YourSecondValue'
You can also start this process directly from your python interpreter.
>>> import matlab.engine
>>> eng = matlab.engine.start_matlab('-desktop')
>>> eng.workspace['yourVar1'] = 1
If you start the matlab session with the -desktop option Matlab's GUI is opened and you can directly see the changes.

Vineet Joshi
Vineet Joshi el 23 de Mzo. de 2021
As per my understanding of your question, you wan to use MATLAB with Python.
All information regarding this can be found here:
You can also consult the following webinar for a detailed overview.

Categorías

Más información sobre Call MATLAB from Python en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by