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.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Citation pour cette source
Mbvalentin (2025). deleteUnusedMFiles() (https://www.mathworks.com/matlabcentral/fileexchange/59883-deleteunusedmfiles), MATLAB Central File Exchange. Extrait(e) le .
Compatibilité avec les versions de MATLAB
Plateformes compatibles
Windows macOS LinuxCatégories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Découvrir Live Editor
Créez des scripts avec du code, des résultats et du texte formaté dans un même document exécutable.
Version | Publié le | Notes de version | |
---|---|---|---|
1.0.0.0 |