gadd
Generalized addition
Syntax
gadd(a,b)
Description
gadd(a,b)
takes two matrices or cell arrays, and adds them in an
element-wise manner.
Examples
Add Matrix and Cell Array Values
This example shows how to add matrix and cell array values.
gadd([1 2 3; 4 5 6],[10;20])
ans = 2×3
11 12 13
24 25 26
gadd({1 2; 3 4},{1 3; 5 2})
ans=2×2 cell array
{[2]} {[5]}
{[8]} {[6]}
gadd({1 2 3 4},{10;20;30})
ans=3×4 cell array
{[11]} {[12]} {[13]} {[14]}
{[21]} {[22]} {[23]} {[24]}
{[31]} {[32]} {[33]} {[34]}
Version History
Introduced in R2010b