# 2.2.2.7 mmathtool

Analysis: Mathematics: Simple Math

## Brief Information

Perform element-wise arithmetic on two matrices

## Command Line Usage

 1. mmathtool -r 2 imb:=[MBook2]MSheet1! formula:="A*2+B-3"; 

2. mmathtool -r 1 ims:=MSheet2 imb:=MSheet1 formula:="A*B" active:=1; 

## Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
A ims

Input

MatrixLayer

<active>

Specifies the input matrix A.

B imb

Input

MatrixLayer

<active>

Specifies the input matrix B.

A-B oms

Output

MatrixObject

<input>

Specifies the output matrix. Get the result of element-wise arithmetic on two matrices.

See the syntax here.

Formula formula

Input

string

<input>

Input the formula for two matrices arithmetic

Note: Add, subtract, multiply, divide and power (+-*/^) are supported in the formula.

Active Matrix in A active

Input

int

0

Specifies whether use the active matrix object in A sheet to arithmetic. If not, use each object in the A sheet will use to arithmetic.

Option List:

• 0=false
• 1=true
B Selection option

Input

int

0

Specifies the matrix objects in B sheet for arithmetic.

Option List:

• 0=active:Active matrix in B
Active matrix object in B sheet
• 1=first:First matrix in B
First matrix object in B sheet
• 2=same:Same matrix in B
Perform arithmetic on the matrix object in B with the same index number as the active matrix object in A.
Note: this option is available, when Active Matrix in A is selected (active=1).
• 3=all:All matrices in both sheets
Perform arithmetic on each matrix object in B by the matrix object in A with the same index number.
Note: this option is available, when Active Matrix in A is unselected (active=0).

## Description

You can use this X-Function to perform element-wise arithmetic on two matrices. You can input the simple math formula.

Keywords:math