mfilecompare

MFILECOMPARE analyzes a set of m-files for the relative overlap of their content
2.2K Downloads
Updated 19 Dec 2010

View License

This function was designed to analyze and display the overlap of the content of a given set of m-files.
A figure will open containing 2 plots (see screenshot). In the left plot the relative overlap of any two files is represented by fields in shades of gray ranging from black (0% overlap) to white (100% overlap). The right plot for each file displays the number of characters of the code part (black) and the comment part(green).

For the analysis of the overlap of (A,B), A is divided into chunks of a given number of characters and each chunk is checked for a match in B. The overlap of (A,B) thus reflects how much of A is found in B, which is not identical to the overlap of (B,A).
The analysis can focus on the entire content, the code or the comments only (settable in a pop-up menu in the lower left corner).

How to use it:
Simply run this function. As an optional input argument you can define the chunk size (default = 10 characters). You will be requested to select a directory containing the files you wish to compare. After that, the analysis figure will be displayed.
For any combination of two files you can access more detailed information (displayed in the text field at the bottom of the figure) by moving the mouse over the respective fields in the plot. By clicking on any field in the left plot the relevant m-files will be opened in the Matlab editor.

I use this function in my Matlab course to check assignments for the amount of collaboration and plagiarism.

Cite As

Mathias Benedek (2024). mfilecompare (https://www.mathworks.com/matlabcentral/fileexchange/29781-mfilecompare), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Environment and Settings in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0