Check if caller == base workspace in MATLAB
Is there a pretty way to check if the caller workspace is actually the base workspace?
I guess I could easily use the assignin
or evalin
functions to assign something in base workspace and then check if that variable has changed or been assigned in caller workspace, but this seems to be kind of a ha开发者_Go百科ck.
Use DBSTACK
%# true if the function has been called from base
callerIsBaseWorkspace = length(dbstack) == 1;
精彩评论