Suppose that you have the following .m script:
% foo.m
function foo = run()
disp('Hello!!');
foo = 1;
end
Now, you execute foo.m from python with:
import matlab.engine
eng = matlab.engine.start_matlab()
py_foo = eng.foo()
This code will set py_foo = 1
AND will display the output Hello
. How do I suppress matlab output?