File Exchange

image thumbnail

Compare two .mat files

version 1.0 (16.8 KB) by

Compare two .mat files and display the contents and difference of mat files.

8 Ratings



No License

Compare two mat files,

useage: matc matfile1.mat matfile2.mat

it will show three different releationship between the variables stored in mat file:

not exist, not equal, equal.

Although one can use
A = load matfile1;
B = load matfile2;
to determine if two mat files are exactly same, it can not help one determine which variable in matfile1 is different or does not exist in matfile2.


matc aa.mat bb.mat
Source File: aa.mat --- Target File: bb.mat
Variable :: a || not exist
Variable :: b || equal
Variable :: c || not equal

Source File: bb.mat --- Target File: aa.mat
Variable :: ab || not exist
Variable :: b || equal
Variable :: c || not equal

Comments and Ratings (9)


I had tons of trouble with this, it even appeared to mess up my search path. I switched to using the one by Michael Arant instead which worked right out of the box.

Samuel Maliva

Very helpful

Please can I get the test function to compare aa.mat and bb.mat


Wenjie (view profile)

Very useful !
It's easy to use and helps a lot.

Jochen Rau

Very useful. Thanks!
Another nice extension would be to integrate sth like submission #22752 (recursive comparison of structures) if a variable is a structure.


Excellent, thank you!


good one

HOng T


Dadi Gudmundsson

Simple, effective, useful.

Helps Alot

Thank you so much

MATLAB Release
MATLAB 6.5 (R13)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today