I want to run and access the output of a Python function in Matlab. Please find below function. The python function returns a Python tuple as output in Matlab. Can I access elements of tuple in Matlab? I do not want to export output as .mat file and import it in Matlab, which will be computationally expensive for my work. Thanks
Python code: python_file name: test_file
import numpy as np
def test (x1, x2, x3, x4):
y = x1 + x2 + x3 + x4
z = y**2
return {"y_value":y,"z_value": z}
Calling python function in Matlab:
f = py.test_file.test(2.2,3.9,4.2,5.1)
Output received in Matlab as of 1 by 1 tuple.
f =
Python tuple with no properties.
(15.4, 237.16000000000003)