Checking functions to be used by a script in Matlab

I have a package of code written by someone else. I am running a script that calls some functions, which in turn calls some other functions, etc. I would like to get a list of functions that are not built-in MATLAB functions but are part of a package.

I tried to use matlab.codetools.requiredFilesAndProducts('file.m')

which gives me a list of such functions, but not all functions. I can see when I look at the code that there are many more functions being called by the function in the script. Does this command only show the first level functions? How can I get a complete list?

+3


source to share


2 answers


Check out the inmem function that can help solve this problem. It displays all matlab functions that are currently in memory. Thus, it lists those functions that were recently called, i.e. Which were called from the last operator clear all

or clear functions

. So you should start with a clean workspace, execute your program and check with inmem

which functions are loaded into the cache and are not in the matlab installation directory, these are the functions you are interested in.



You can also use a helper command line disp-inmem

that has been programmed (halfway) to automate this task.

+1


source


This function works well, but it is not guaranteed to receive all files. Works great for me though



http://www.mathworks.com/matlabcentral/fileexchange/15484-recursively-get-file-dependencies-of-a-given-function/content/getFileDependencies.m

+2


source







All Articles