If you have graphical user interface (GUI) intensive applications that execute a lot of callbacks through the MATLAB® engine, you should force these callbacks to be evaluated in the context of the base workspace. Use evalin to specify that the base workspace be used in evaluating the callback expression. For example:
engEvalString(ep, "evalin('base', expression)")
Specifying the base workspace in this manner ensures MATLAB processes the callback correctly and returns results for that call.
This does not apply to computational applications that do not execute callbacks.