I'm trying to do a similar thing as http://www.daniweb.com/software-development/python/threads/392697/calling-matlab.m-file-from-python.
I managed to have Matlab launch, and run my Matlab file as the GUI of my matlab function is shown on screen. However it only stays on screen for 1 second, and Matlab closes !
import subprocess as sp command = """/Applications/MATLAB_R2012b.app/bin/matlab -r "cd(fullfile('/Users/Jules/Dropbox/CODES/Matlab/')), coverGUI_AL_FOV" """ sh=sp.Popen(command, stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE, shell=True) print sh.communicate()
By the way, I looked at http://docs.python.org/2/library/subprocess.html but I'm not getting what all the stdin/out/err are, so I just put these in my code with no real reason..
If anyone has an idea why the process seems to quit, that would help me a lot !