Applying a Function to an Array - Untitled
Description: Untitled

Next: Special Utility Matrices, Previous: Rearranging Matrices, Up: Matrix Manipulation

### 16.3 Applying a Function to an Array

— Function File: a = arrayfun (name, c)
— Function File: a = arrayfun (func, c)
— Function File: a = arrayfun (func, c, d)
— Function File: a = arrayfun (func, c, options)
— Function File: [a, b, ...] = arrayfun (func, c, ...)

> Execute a function on each element of an array. This is useful for functions that do not accept array arguments. If the function does accept array arguments it is better to call the function directly.

> See `cellfun` for complete usage instructions.

> See also: cellfun.

— Loadable Function: bsxfun (f, a, b)

> Applies a binary function f element-wise to two matrix arguments a and b. The function f must be capable of accepting two column vector arguments of equal length, or one column vector argument and a scalar.

> The dimensions of a and b must be equal or singleton. The singleton dimensions of the matrices will be expanded to the same dimensionality as the other matrix.

> See also: arrayfun, cellfun.