Variable holding the name of executing function or script in MATLAB?
Is there any environment or int开发者_如何学编程ernal variable in MATLAB that holds the name of the current executing function or workspace?
If not, what would be an easy way of defining this variable for every script/function within a toolbox or folder?
Having such variable always in the workspace would be helpful for debugging, for example:
One could easily trace the execution of user-defined functions in the command window, e.g.
disp(name_of_running_function);
One could conveniently save the (full or partial) memory state of running functions to disk, e.g.
save(name_of_running_function, 'all');
Thanks
mfilename
: See here. Found through Google.
精彩评论