Main Content


(To be removed) Subtract vector from array along specified dimension

dsp.ArrayVectorSubtractor will be removed in a future release. Use the operator instead. For more information, see Compatibility Considerations.


The ArrayVectorSubtractor object subtracts a vector from an N-D array along a specified dimension.

To subtract a vector from an N-D array along a specified dimension:

  1. Define and set up your array-vector subtraction object. See Construction.

  2. Call step to subtract the vector according to the properties of dsp.ArrayVectorSubtractor. The behavior of step is specified to each object in the toolbox.


Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.


avs = dsp.ArrayVectorSubtractor returns an array-vector subtraction object, avs, that subtracts the elements of a vector from an N-D input array along the first dimension.

avs = dsp.ArrayVectorSubtractor('PropertyName',PropertyValue,...) returns an array-vector subtraction object, avs, with each property set to the specified value.



Dimension along which to subtract vector elements from input

Specify the dimension along which to subtract the elements of the vector from the input array as an integer-valued scalar greater than 0. The default is 1.


Source of vector

Specify the source of the vector values as one of Input port or Property. The default is Input port.


Vector values

Specify the vector values. This property applies when you set the VectorSource property to Property. The default is [0.5 0.25]. This property is tunable.

 Fixed-Point Properties


stepSubtract vector from array along specified dimension
Common to All System Objects

Allow System object property value changes


collapse all


If you are using R2016a or an earlier release, replace each call to the object with the equivalent step syntax. For example, obj(x) becomes step(obj,x).

avs = dsp.ArrayVectorSubtractor;
a = ones(2);
x = [1 2]';
y = avs(a, x)
y = 2×2

     0     0
    -1    -1


This object implements the algorithm, inputs, and outputs described on the Array-Vector Subtract block reference page. The object properties correspond to the block parameters, except:

The array-vector subtraction object does not have Minimum or Maximum options for data output.

Compatibility Considerations

expand all

Not recommended starting in R2021a

Extended Capabilities

Introduced in R2012a