Hello

I am working on project In django(Python web framework) where I want to call matlab file(.m ) file from the server.
I tried subprocess module from the python

>>> p = Popen("/Applications/MATLAB_R2009a.app/bin/matlab.exe  -nojvm -nosplash -nodisplay -r /home/spatil/LineShapeKin_Simulation_4/LineShapeKin_Simulation_4.1/Matlab_code/Simulate.m",stdout=PIPE)

But its giving me following error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/sw/lib/python2.6/subprocess.py", line 595, in __init__
    errread, errwrite)
  File "/sw/lib/python2.6/subprocess.py", line 1092, in _execute_child

Please give me some direction....


Snehal

Recommended Answers

All 4 Replies

Its worked!!!!!!!Thanks....

Hello !

I'm trying to do a similar thing here. 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 !
Thanks

Moved to new thread

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.