MATLAB: Am I unable to view the difference between these two images

imageimage analysisimage processingmatricesmatrixmatrix manipulation

I used two different programs to align a series of frames in a tiff file to later analyze. Out of curiosity, I'm wondering if each program yielded the same set of aligned images. Say program 1 spit out file1 and program 2, file2. How can I check to see that the difference is a zero matrix if the following specifications for file1 and file2 are as follows:
FileSize: 196788
Format: 'tif'
FormatVersion: []
Width: 256
Height: 256
BitDepth: 24
ColorType: 'truecolor'
FormatSignature: [73 73 42 0]
ByteOrder: 'little-endian'
NewSubFileType: 0
BitsPerSample: [8 8 8]
Compression: 'Uncompressed'
PhotometricInterpretation: 'RGB'
StripOffsets: 180
SamplesPerPixel: 3
RowsPerStrip: 256
StripByteCounts: 196608
XResolution: 1
YResolution: 1
ResolutionUnit: 'None'
Colormap: []
PlanarConfiguration: 'Chunky'
TileWidth: []
TileLength: []
TileOffsets: []
TileByteCounts: []
Orientation: 1
FillOrder: 1
GrayResponseUnit: 0.0100
MaxSampleValue: [255 255 255]
MinSampleValue: [0 0 0]
Thresholding: 1
Offset: 8
FileSize: 162046
Format: 'tif'
FormatVersion: []
Width: 256
Height: 256
BitDepth: 16
ColorType: 'grayscale'
FormatSignature: [73 73 42 0]
ByteOrder: 'little-endian'
NewSubFileType: 0
BitsPerSample: 16
Compression: 'LZW'
PhotometricInterpretation: 'BlackIsZero'
StripOffsets: 8
SamplesPerPixel: 1
RowsPerStrip: 256
StripByteCounts: 161900
XResolution: []
YResolution: []
ResolutionUnit: 'Inch'
Colormap: []
PlanarConfiguration: 'Chunky'
TileWidth: []
TileLength: []
TileOffsets: []
TileByteCounts: []
Orientation: 1
FillOrder: 1
GrayResponseUnit: 0.0100
MaxSampleValue: 65535
MinSampleValue: 0
Thresholding: 1
Offset: 161908
SampleFormat: 'Unsigned integer'
Matlab is complaining that Matrix dimensions don't agree. I've done a similar analysis on different frames from the same tiff file and haven't run into issues, so what's wrong?
file1 = '/Users/...';
file2 = '/Users/...';
A = double(imread(file1,1));
B = double(imread(file2,1));
C = A - B

Best Answer

Matlab is complaining that Matrix dimensions don't agree.
Please post a copy of the error message instead of paraphrasing it. The message is clear: A and B have different sizes. Use the debugger to check this:
size(A)
size(B)
As Walter has pointed out already, one image is a true-color image (3 dimensions) and the other one a gray scale image (2 dimensions). Then you cannot subtract them.
The debugger is very useful to solve such questions:
dbstop if error