Callbacks in Applications
If you have a user interface that executes many callbacks through the MATLAB® engine, force these callbacks to be evaluated in the context of the base
evalin to specify the base workspace for evaluating the
callback expression. For example:
Specifying the base workspace ensures MATLAB processes the callback correctly and returns results for that call.
This advice does not apply to computational applications that do not execute callbacks.