Investment Studio > Expressions > Functions > Matrix > MSUB

float array[m][n] msub(float array[m][n] a, float array[m][n] b)

Returns the matrix difference of float arrays a and b. The arrays must have the same dimensions.

Non-numeric array elements are automatically converted to numbers. If conversion fails, they are treated as zeros.

Equivalent to the subtraction operator (-) with array operands (a - b).

The result is an array with the same dimensions as the argument arrays.

Example

=msub({{6, 5}, {4, 3}, {2, 1}}, {{7, 8}, {9, 10}, {11, 12}})

equals {{-1, -3}, {-5, -7}, {-9, -11}}

=msub({{6, 5}, {4, 3}, {2, 1}}, {{"7", "8"}, {"9", "10"}, {"", ""}})

equals {{-1, -3}, {-5, -7}, {2, 1}}.

See also mmult, msum.