Table Of Contents

ones

Version:
    Last Modified: December 12, 2016

    Generates an array of any dimension of ones.

    Syntax

    c = ones(a)
    c = ones(a, b)
    c = ones(a, b, ...)
    c = ones(v)
    c = ones(a, class)
    c = ones(a, b, class)
    c = ones(a, b, ..., class)
    c = ones(v, class)

    Inputs

    a

    Number of rows in c. a is a non-negative integer. If a is zero, the function returns an empty array.

    b

    Number of columns in c. b is a non-negative integer. If b is zero, the function returns an empty array.

    ...

    Further parameters for specifying the number of elements in higher dimensions. You can replace one parameter for any dimension with an empty array, for example, reshapemx([1,2,3,4,5,6], 2, []). The array then is a placeholder for an unspecified size. MathScript uses the array size and the reshape size to calculate the unspecified size automatically.

    v

    Vector with number of rows, columns, and further dimensions. v must contain non-negative integer values.

    class

    Class of the returned array.

    Name Description
    'double'

    double

    'single'

    single

    'uint8'

    uint8

    'int8'

    int8

    'uint16'

    uint16

    'int16'

    int16

    'uint32'

    uint32

    'int32'

    int32

    'uint64'

    uint64

    'int64'

    int64

    Outputs

    c

    Array of any dimensions whose elements are all 1s. If you only specify a, c returns a square matrix of order a. If input parameters are zero, c is an empty array.

    C = ones(3, 5)

    Where This Node Can Run:

    Desktop OS: Windows

    FPGA: DAQExpress does not support FPGA devices


    Recently Viewed Topics