ldivide

Left array division, the function form of the operator .\.

Category: Symbolic Computations in MATLAB > Operators and Elementary Operations

Syntax

C = ldivide(A, B)

Same as A .\ B, that is B ./ A.

Description

The element of A divides the matching element of B, which is the opposite order of rdivide. Dividing by zero gives Inf (or NaN for 0\0). For integer types the result is rounded to an integer and saturates: ldivide(int8(2), int8(7)) is 4.

This is not the matrix left division A \ B, which solves linear systems.

Input arguments

A, B
Numeric or symbolic arrays with compatible sizes. A is the divisor.

Output arguments

C
Elementwise quotient B(i)/A(i).

Example

Elementwise left division

ldivide(2, [4 6 8])
ldivide([1 2 3], [4 6 9])
ldivide(0, 1)
ldivide(int8(2), int8(7))
Output
ans = 1×3

     2     3     4
ans = 1×3

     4     3     3
ans = Inf
ans = int8
   4

See also

rdivide mldivide times power