FUNCTION REFERENCE

ones

Array of ones.

Array of ones.

Syntax

ones(n)

Syntax

ones(r, c)

Syntax

ones([r c])

ones(n) is n-by-n. A size vector such as size(A) is accepted.

Syntax

ones(..., 'single')

Syntax

ones(..., 'like', single(1))

Example

ones(2, 'single')

Example

ones(2, 3)   % 2-by-3 array of ones

Class names 'single' and int8 through uint64 are accepted, as are typed integer/single 'like' prototypes.

Differences from MATLAB: Two-dimensional output only.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.