I called a Matlab function from Python, the function has 3 outputs. Python gives ValueError: not enough values to unpack (expected 3, got 2). Here's the Matlab function testCalledByPython:
function [otpt1, otpt2, otpt3] = testCalledByPython(inpt)
otpt1 = rand(inpt, inpt);
otpt2 = magic(inpt);
otpt3 = zeros(inpt, inpt);
This is the Python script to call the above function:
#!/usr/bin/env python3
import matlab.engine
eng = matlab.engine.start_matlab()
otpt1, otpt2, otpt3 = eng.testCalledByPython(2)
If I replace the last line by otpt1, otpt2 = eng.testCalledByPython(2), it runs, but the outputs are:
otpt1, otpt2
Out[5]:
(matlab.double([0.8147236863931789,0.12698681629350606]),
matlab.double([0.9057919370756192,0.9133758561390194]))
Obviously these are wrong outputs. How can I solve it?