python - Matlab returns exit code immediately -
i creating various matlab .m-files python , run them using subprocess. when files finished delete them:
command = ['c:\\matlabr2012b\\bin\\matlab.exe', '-nodesktop', '-nosplash', '-r', 'mfile'] matlab = subprocess.popen(command) # launch matlab m file matlab.wait() # wait matlab finish before deleting .m file print "delete" os.remove(self.filename) the problem matlab.wait() never waits, since matlab returns exit code 0 immediately. there way check if matlab has finished?
on windows, there both bin\matlab.exe , bin\win32\matlab.exe (or bin\win64\matlab.exe). former wrapper around latter , pretty exits immediately.
you can either call bin\win32\matlab.exe directly or use -wait option when calling bin\matlab.exe.
Comments
Post a Comment