Table Of Contents

padarray

Version:
    Last Modified: March 15, 2017

    Adds elements to an array of any dimension. padarray(x, n) adds n zeros to both ends of x.

    Syntax

    y = padarray(x, n)
    y = padarray(x, n, element)
    y = padarray(x, n, option)
    y = padarray(x, n, element, direction)
    y = padarray(x, n, option, direction)

    Inputs

    x

    Array to add elements to. x is an array of any dimension.

    n

    Number of elements to add to each dimension of x. n is a vector. The length of n must be equal to the number of dimensions of x.

    element

    Element to add to x repeatedly. element is a scalar.

    Default: 0

    option

    Specifies how to add elements to x. option is a string that accepts the following values:

    Name Description
    'circular'

    Adds elements by circularly repeating the existing elements.

    'replicate'

    Adds elements by repeating the element on the border.

    'symmetric'

    Adds elements by mirroring elements about the border.

    direction

    Direction to add elements to x. direction is a string that accepts the following values:

    Name Description
    'both'

    Adds elements to both ends of x.

    'pre'

    Adds elements before the start of x.

    'post'

    Adds elements after the end of x.

    Default: 'both'

    Outputs

    y

    x with added elements.

    X = rand(10, 1);
    Y = padarray(X, 6, 0, 'post')

    Where This Node Can Run:

    Desktop OS: Windows

    FPGA: This product does not support FPGA devices


    Recently Viewed Topics