gsubtract
R2026b(To be removed) Generalized subtraction
gsubtract will be removed in a future release. For more information,
see Transition Legacy Neural Network Code to dlnetwork Workflows.
For advice on updating your code, see Version History.
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 =
-9 -8 -7
-16 -15 -14gsubtract({1 2; 3 4},{1 3; 5 2})ans =
2x2 cell array
{[ 0]} {[-1]}
{[-2]} {[ 2]}gsubtract({1 2 3 4},{10;20;30})ans =
3x4 cell array
{[ -9]} {[ -8]} {[ -7]} {[ -6]}
{[-19]} {[-18]} {[-17]} {[-16]}
{[-29]} {[-28]} {[-27]} {[-26]}Version History
Introduced in R2010bSee Also
minus | Time Series
Modeler | fitrnet (Statistics and Machine Learning Toolbox) | fitcnet (Statistics and Machine Learning Toolbox) | trainnet | trainingOptions | dlnetwork