Code covered by the BSD License  

Highlights from
mfilecompare

4.0

4.0 | 1 rating Rate this file 6 Downloads (last 30 days) File Size: 3.75 KB File ID: #29781
image thumbnail

mfilecompare

by Mathias Benedek

 

19 Dec 2010

MFILECOMPARE analyzes a set of m-files for the relative overlap of their content

| Watch this File

File Information
Description

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.

MATLAB release MATLAB 7.6 (R2008a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
08 Mar 2012 Eric Diaz

Just the idea I was looking for. Although, I really was looking for something a little bit more actually like side-by-side compare, highlighting parts that were different. but this serves well in the interim.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
mfile Mathias Benedek 20 Dec 2010 07:55:46
content analysis Mathias Benedek 20 Dec 2010 07:55:46
overlap Mathias Benedek 20 Dec 2010 07:55:46
code Mathias Benedek 20 Dec 2010 07:55:46
comments Mathias Benedek 20 Dec 2010 07:55:46
plagiarism Mathias Benedek 20 Dec 2010 07:55:46

Contact us at files@mathworks.com