Back to Core Functions
ones
Create array of all ones
Syntax
X = ones(n) X = ones(m, n)
Description
Creates an array of ones with the specified dimensions. A single argument `n` creates an n×n matrix.
Parameters
| Name | Description |
|---|---|
| m | Number of rows |
| n(optional) | Number of columns |
Returns
NDArray of ones with the given shape