DADiSP Worksheet Functions > Function Categories > Generated Series > ONES

 

ONES

Purpose:

Creates an array of all ones.

Syntax:

ONES(numrows, numcols, dx, dy)

numrows

-

An integer. The number of output rows.

numcols

-

Optional. An integer, the number of output columns. Defaults to numrows.

dx

-

Optional. A real, the increment between X values. Defaults to 1.0.

dy

-

Optional. A real, the increment between Y values. Defaults to 1.0.

Returns:

A series or array.

Example:

ones(3, 1)

 

returns the series {1, 1, 1}

Example:

ones(3, 1, 0.1)

 

Same as the previous example except the DELTAX is set to 0.1.

Example:

ones(3)

 

returns the 3x3 array:

 

{{1, 1, 1},

 {1, 1, 1}, 

 {1, 1, 1}} 

Remarks:

ones(size(A)) returns a array of all ones with same dimension as A.

See Also:

EYE

GLINE

GVALARRAY

RAVEL

SIZE

ZEROS