Language Reference

Subtraction Operator:   -

subtracts corresponding matrix elements

matrix1 - matrix2
matrix - scalar
matrix - vector

The subtraction infix operator (-) produces a new matrix containing elements that are formed by subtracting the corresponding elements of matrix2 from those of matrix1.

In addition to subtracting conformable matrices, you can also use the subtraction operator to subtract a matrix and a scalar or a matrix and a row or column vector. When either argument is a scalar, the operation is performed by using the scalar against each element of the matrix argument. If either operand is a row or column vector, then the operation is performed using that vector on each of the rows or columns of the matrix.

When a missing value occurs in an operand, IML assigns a missing value for the corresponding element in the result.

An example of a valid statement follows:

  
    c=a-b;
 

Previous Page | Next Page | Top of Page