开发者

Check if caller == base workspace in MATLAB

开发者 https://www.devze.com 2023-04-13 05:34 出处:网络
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 chec

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; 
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号