deleteUnusedMFiles()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% (!!!!) WARNING, ACHTUNG, CUIDADO, ATTENTION: This function was created to
% help the user DELETE unused files in an automated way. Use it CAREFULLY
% and under your own responsability. I DO NOT TAKE ANY RESPONSABILITY for
% any damage caused to your computer/files!!!!
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This function searches for unused m files and let's the user delete
% them, or make a copy to a backup directory before deleting them.
% The procedure is simple: the native matlab's function
% matlab.codetools.requiredFilesAndProducts( 'filename_function.m' ),
% analyzes the function 'filename_function.m' in the current directory
% (pwd) and finds all dependant functions. In other words, this function
% returns all functions that are required for 'filename_function.m' to work
% properly. When a function does not require any other function to run
% apart from itself, matlab will just return the name of the function itself.
% Therefore, we can analyze all m files in a certain directory and find
% which functions are required for each file. We concatenate all these
% 'USED & REQUIRED' files in a variable. After checking all files, we
% compare the used & required files with the list of filenames on that
% directory. The filenames that don't appear in the used & required list
% are the functions that aren't called by anyone apart from themselves.
% This can have two meanings: 1) This function is a MAIN function that
% calls other subfunctions but is not called by anyone (like if you create
% a main GUI file/script) or 2) This function is not used and can be safely
% removed from this directory.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
引用格式
Mbvalentin (2025). deleteUnusedMFiles() (https://ww2.mathworks.cn/matlabcentral/fileexchange/59883-deleteunusedmfiles), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.0.0.0 |