gsubtract
Generalized subtraction
Syntax
gsubtract(a,b)
Description
gsubtract(a,b)
takes two matrices or cell arrays, and subtracts them
in an element-wise manner.
Examples
Subtract Matrix and Cell Array Values
This example shows how to subtract matrix and cell array values.
gsubtract([1 2 3; 4 5 6],[10;20])
ans = 2×3
-9 -8 -7
-16 -15 -14
gsubtract({1 2; 3 4},{1 3; 5 2})
ans=2×2 cell array
{[ 0]} {[-1]}
{[-2]} {[ 2]}
gsubtract({1 2 3 4},{10;20;30})
ans=3×4 cell array
{[ -9]} {[ -8]} {[ -7]} {[ -6]}
{[-19]} {[-18]} {[-17]} {[-16]}
{[-29]} {[-28]} {[-27]} {[-26]}
Version History
Introduced in R2010b