How can I search for all occurrences of built-in MATLAB functions called from multiple .m and .mlx files?
Ältere Kommentare anzeigen
I am teaching numerical methods with MATLAB, and the teaching material I have developed over time includes a vast number of MATLAB files (.m and .mlx) stored in a folder and its subfolders on my laptop.
I want to create a table listing all built-in MATLAB functions called in the code across these MATLAB files. Is there a way to search through all MATLAB files in a folder and its subfolders to identify and tabulate the MATLAB functions used? Ideally, I would like the result in a table format like this:
Function Files
----------------------------------------------
plot <filename_a1>, ..., <filename_an>
fprintf <filename_b1>, ..., <filename_bm>
...
----------------------------------------------
1 Kommentar
Walter Roberson
am 27 Nov. 2024
Unfortunately, https://www.mathworks.com/help/matlab/ref/matlab.codetools.requiredfilesandproducts.html does not list built-in functions.
Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 27 Nov. 2024
0 Stimmen
You might try to get a list of functions by using dir() to find all m-files in all subfolders of your MATLAB installation folder. I'm not sure it will find all built-in functions though. It might find a lot of them though. Then loop over all of your own m-files written by you and open them up with something like fileread or readlines and search the contents of your custom written for each of the function names you found.
You might find the FAQ useful: Process a sequence of files
Kategorien
Mehr zu File Operations finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!