Possible Duplicate:
Call Python function from MATLAB
I need to call a Python function from a MATLAB environment. Is it possible?
Let's assume, I have the following Python code:
def squared(x):
y = x * x
return y
How do I call square开发者_开发百科d(3) from MATLAB workspace/code and get 9?
I have never done this before, so someone else will have to provide a 'real' answer, but I can offer this.
I often call the shell from MATLAB on my Linux machine, with an exclamation point, >>!{comm} So I suppose you could have a shell script that calls python and call the script from MATLAB.
wbg
精彩评论