from python to matlab
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
qrqr
el 1 de Ag. de 2019
Respondida: Loretta Laughrey
el 20 de Mayo de 2020
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 comentarios
Respuesta aceptada
Wiley Mosley
el 2 de Ag. de 2019
Editada: Wiley Mosley
el 2 de Ag. de 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.
Más respuestas (2)
Loretta Laughrey
el 20 de Mayo de 2020
Just pass the variable in a function call:
In Python:
eng = matlab.engine.start_matlab("-desktop")
eng.cd(myscripts, nargout=0) # change to the folder with the scripts
results = eng.mymatlabscript(self.A, self.B, nargout = 0, async = False)
In MATLAB
function mymatlabscript(A, B)
0 comentarios
Ver también
Categorías
Más información sobre Call Python from MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!