For example, add a row and column vector. The result is the same as
bsxfun(@plus,a,b).
a = [1 2 3 4]
ans =
1 2 3 4
b = [5; 6; 7]
ans =
5
6
7
a + b
ans =
6 7 8 9
7 8 9 10
8 9 10 11
See Also
bsxfun
More About
- “Array vs. Matrix Operations” on page 2-13
- “MATLAB Operators and Special Characters” on page 2-2
2 Program Components