How to use the Python script in Matlab to call the variables which defined in Matlab workspace? -
in matlab, variables can defined, example:
>>global x y >>x = 1; >>y = 2;
then, try call variables x
, y
in pre-defined python scriptf()
as:
def f(): global x y return x + y
however, when run python script in matlab:
>>py.f.f >>ans = >> 0
it returns 0
, expected value should 3
.
Comments
Post a Comment