Check if the caller base workspace is working in MATLAB

Is there a good way to check if the caller’s workspace is the underlying workspace?

I think I could easily use the assignin or evalin functions to assign something to the base workspace, and then check to see if this variable has been changed or assigned to the caller's workspace, but it looks like a hack.

+4
source share
1 answer

Use DBSTACK

 %# true if the function has been called from base callerIsBaseWorkspace = length(dbstack) == 1; 
+4
source

All Articles