running python script in matlab

Asked by sai vasavi on 22 Jun 2012
Latest activity Commented on by sai vasavi on 10 Jul 2012

Hi, I have one python script and i want to execute that in matlab.I tried with system in matlab. s=system('python trail.py 3') while excuting this command i'm getting a error like below. 'python' is not recognized as an internal or external command, operable program or batch file. Please can anybody help me in fixing this error. Thanks in advance

Regards Vasavi

0 Comments

sai vasavi

Products

No products are associated with this question.

1 Answer

Answer by Walter Roberson on 22 Jun 2012
Accepted answer

Either python is not installed in your system or it is not on your MS Windows PATH as known to MATLAB.

Inside MATLAB, command

   getenv('PATH')

and see what it shows.

Note: python is not automatically installed as part of MATLAB. perl is, though, installed as part of MATLAB.

5 Comments

sai vasavi on 2 Jul 2012

Thanks for your comment Walter. I am also new to this python.Please share any information regarding this request if any.I searched in google but i did n't get any solution to solve this.

Walter Roberson on 2 Jul 2012

http://docs.python.org/tutorial/interpreter.html#invoking-the-interpreter

Thus for example

arg1 = 'C:\TEMP\MyInputFile.txt';
s = system( sprintf('python mypython.py "%s"', arg1) );
sai vasavi on 10 Jul 2012

Thanks for your response Walter.That issue is resolved.Now I am able to run that python function in matlab and saving the putput in workspace. I developed the code which can do the sam ehow perl functions are executed in matlab environment. Anyhow thanks for your help.

Walter Roberson

Contact us