Compare two .mat files

Compare two .mat files and display the contents and difference of mat files.
3.7K Downloads
Updated 10 Jun 2004

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;
isequal(A,B)
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.

Example:

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
--------------------------------------------------

Cite As

Xianyao Chen (2024). Compare two .mat files (https://www.mathworks.com/matlabcentral/fileexchange/5160-compare-two-mat-files), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on File Operations 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

Including source code.