MATLAB: Compare MAT files and return logical output

comparedifferentfileloadmatMATLABsamevisdiff

How do I compare two MAT-files so that I get 1 if they are the same and 0 if they are different?
I know this "visdiff" function will give me an HTML report on their similarities, but all I want is if they are the same or not.

Best Answer

This can be done by loading in the MAT files to specific variables and then calling the "isequal" function.
>> A = load('matfile1.mat');
>> B = load('matfile2.mat');
>> isequal(A,B)