extendVEC

extendVEC extends vector x inserting value in the positions in index

Syntax

  • ext=extendVEC(x, index, value)example

Description

example

ext =extendVEC(x, index, value) Example 1: Row vector extended with the inclusion of multiple elements "Inf" in the tail.

Examples

expand all

  • Example 1: Row vector extended with the inclusion of multiple elements "Inf" in the tail.
  • x = [1 2 3 4 5 6];
    index = [2 5 11];
    ext = extendVEC(x, index, Inf)

    Input Arguments

    expand all

    x — Vector to be extended. It can be either a row or a column vector.

    Data Types: single| double

    index — A vector containing the positions where to add value inside x. The index values are sorted so that the code starts to insert the element "value" from the smallest position.

    Data Types: single| double

    value — The element to insert in x for the extension. It could be a number, string, NaN, Inf, etc...

    Data Types: single| double

    Output Arguments

    expand all

    ext —The extension of vector x with the element value inserted in the positions in index. For index > length(x), the code inserts index-length(x) elements equal to value in the tail of x

    It can be either a row or a column vector, depending on input x.

    Copyright 2008-2020.

    Written by FSDA team

    See Also

    This page has been automatically generated by our routine publishFS