I'm teaching myself a little bit of programming in python and also mathlab. And I need to run a couple of functions I wrote in python with matlab.
I saw this example: In python
import sys
def squared():
y=x*x
return y
if __name__ == '__main__':
x = float(sys.argv[1])
sys.stdout.write(str(squared(x)))
then in matlab
[status,result]=system('nameofthescrip', 3)
status=0
result=9.0
but, I don't know when I try with my functions it doesn't work.
my program goes something like this:
def function_1():
Shows something on screen
return
def function_2():
hear a sound
return
def function_3():
write a number and press a key
return
x=[function_1,funciotion_2,function_3]
random.shuffle(x)
But then I don't know what to put inestead of
if __name__ == '__main__':
x = float(sys.argv[1])
sys.stdout.write(str(squared(x)))
So that I can run it from matlab, just as the example I wrote first!