From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search


Apply simple arithmetic operations to all or part of dataset.


[cx] = arithmetic(x);
[cx] = arithmetic(x, op, const);
[cx] = arithmetic(x, op, const, indices);
[cx] = arithmetic(x, op, const, indices, modes);


Apply an arithmetic operation to the input dataset or array (n-way), or a specified subset thereof. The supported operations are listed below. These are applied element-wise, so 'multiply' is applied as '.*' for example. The operation is applied to x or the specified subset of x.

Available operations:

 add      : Adds const.                        xij = xij+const
 subtract : Subtract const.                    xij = xij-const
 multiply : Multiply by const.                 xij = xij*const
 divide   : Divide by const.                   xij = xij/const
 inverse  : Invert and multiply by const.      xij = const/xij
 power    : Raise to power of const.           xij = xij^const
 root     : Take const root.                   xij = xij^(1/const)
 modulus  : Modulus after division by const.   xij = mod(xij,const)
 round    : Round to nearest 1/const fraction. xij = round(xij*const)/const
 log      : Log to base const.                 xij = log(xij)/log(const)
 antilog  : Antilog to base const.             xij = const^(xij)
 noop     : Identity op. Make no change.       xij = xij


  • x = dataset or array.

Optional Inputs

  • operation = name (char) of arithmetic operation to apply.
  • const = value (double) used in the operation.
  • indices = a cell of requested indices (e.g. {[1:5] [10:20]} ).
  • modes = Modes (integer, or vector) to which indicies should be applied. See nindex/nassign for indices and modes usage.


  • cx = modified dataset or array.


options = a structure array with the following fields:

  • isundo: [ 'yes' | {'no'} ] Change operation to undo mode.

See Also

nindex, preprocess