FUNCTION REFERENCE
bsxfun
Apply a two-input function with singleton expansion.
Apply a two-input function with singleton expansion.
Syntax
C = bsxfun(fun, A, B)fun must be a function handle. A dimension of size 1 in one input is repeated to match the other input. Handles to built-in functions such as @plus receive the expanded arrays at once; user functions and anonymous handles receive one column (or a column and a scalar) at a time.
Example
bsxfun(@plus, [1 2 3], [10; 20]) % [11 12 13; 21 22 23]Differences from MATLAB: Two-dimensional arrays only.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.