I have a Matlab function name as a string (the variable name is 'function_name'), which is an input from a user, and I need to somehow call that function from Python. Below you can see how I was trying to call this function using the variable name, but it exited with the following error: (<class 'matlab.engine.MatlabExecutionError'>, MatlabExecutionError("Undefined function 'chsn_agthm' for input arguments of type 'uint8'.\n"), <traceback object at 0x0000015D14323C00>)
import matlab.engine
eng = matlab.engine.start_matlab()
res = eng.function_name(input1, input2, nargout=2)
res = eng.feval( function_name, input1, input2, nargout=2), withfunction_namebeing a string of an existing MATLAB function. I cannot test myself, so if it is working, feedback would be welcome.