Z = imdivide(X,Y)
divides each element in the array X by the corresponding element
in array Y and returns the result in the corresponding element of
the output array Z.
This example shows how to divide two uint8 arrays.
X = uint8([ 255 0 75; 44 225 100]);
Y = uint8([ 50 50 50; 50 50 50 ]);
Divide each element in X by the corresponding element in Y. Note that fractional values greater than or equal to 0.5 are rounded up to the nearest integer.
Z = imdivide(X,Y)
Z = 2x3 uint8 matrix
5 0 2
1 5 2
Divide each element in Y by the corresponding element in X. Note that when dividing by zero, the output is truncated to the range of the integer type.
First array, specified as a numeric array or logical array of any
dimension.
Y — Second array numeric scalar | numeric array | logical array
Second array (divisor) to be divided from X,
specified as a numeric or logical array of the same size and class as
X, or a numeric scalar of type
double.
Quotient, returned as a numeric array of the same size as
X. Z is the same class as
X unless X is logical, in
which case Z is data type double. If
X is an integer array, elements of the output that
exceed the range of the integer type are truncated, and fractional values
are rounded.