how do i run a pyhton script from matlab?

Hello, anyone knows how can i run the attached python script via matlab?
"def InitPar(d):
d.SdoWr(0x3004, 0x00, 0)
d.SdoWr(0x3000, 0x00, 0x1)
d.SdoWr(0x3000, 0x00, 0x82)
#------------------------------------------------------------------------------
if __name__ == '__main__':
from mc.dsa import *
import time
import os
time_sync = open("time_sync.txt", "w+")
time_sync.write(str(time.localtime()))
time_sync.close()
s_t=time.clock()

2 comentarios

Looky
Looky el 21 de Dic. de 2017
Editada: Looky el 21 de Dic. de 2017
You have 2 possiblites.
  1. You can run it through the matlab console ( system('python ...'")). See here
  2. Or if you have CPhython, you can have a look at a direct call within matlab. See here
The third option is of course to consider implementing this into matlab.
Orel Levy
Orel Levy el 21 de Dic. de 2017
thanks, the first option seems to work perfect.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Productos

Etiquetas

Preguntada:

el 21 de Dic. de 2017

Comentada:

el 21 de Dic. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by