How to call matlab from python?

13 visualizaciones (últimos 30 días)
M bd
M bd el 23 de Ag. de 2021
Editada: Dave B el 24 de Ag. de 2021
I have one code of matlab from which some results I want to export directly to python. How I can call matlab from python to use that specific results?

Respuesta aceptada

Dave B
Dave B el 24 de Ag. de 2021
I think you mean you want to call a MATLAB function from Python?
Alternatively, if you want to export results from MATLAB to a file that you can read in Python, there are lots of options for file formats depending on the data. if you have neatly organized matrix data, you might consider using writematrix to make a comma delimited file and csv.py to read it. Or if you have something more complicated, maybe h5write to write make an hdf5 file and h5py to read it.
  2 comentarios
M bd
M bd el 24 de Ag. de 2021
@Dave B actually i have code that gives some result which i want to use in python. i dont want to open matlab, run that code, find the result, export that result in some file format to python.
i want to do it like that if somehow i can say python that you call matlab to run that matlab code and results which is generated by that matlab code automatically export to the python.
do you have any idea, how can i do that?
Dave B
Dave B el 24 de Ag. de 2021
Editada: Dave B el 24 de Ag. de 2021
@M bd Please have a look at the links above, they are describing how to do exactly what you're asking. The first link shows python code to return the output of a MATLAB function, but you'll probably have to work out the setup/installation as described in the second link.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by