Run the following code example:
%
X = randi(100, 5, 5);
Y = randi(100, 5, 5);
%
X = uint8(X);
Y = uint8(Y);
%
A = X - Y;
%
X = double(X);
Y = double(Y);
%
B = X - Y;
For a given sample run:
A =
0 15 36 0 0
0 0 0 0 3
0 0 0 25 0
13 0 15 0 0
0 49 0 0 14
and
B =
-8 15 36 -4 -65
0 -47 -45 -11 3
-18 -17 -11 25 -52
13 -53 15 -15 -1
-35 49 -47 -8 14
You will notice that all negative numbers in Awere replaced by 0, and negative numbers in are Bdisplayed correctly.
: , , Matlab 0. , , "" ( ), double, , , int, int8, int16, int32 int64.