Function Reference
— Built-in Function: ones (x)
— Built-in Function: ones (n, m)
— Built-in Function: ones (n, m, k, ...)
— Built-in Function: ones (..., class)

Return a matrix or N-dimensional array whose elements are all 1. The arguments are handled the same as the arguments for eye.

If you need to create a matrix whose values are all the same, you should use an expression like

          val_matrix = val * ones (n, m)

The optional argument class, allows ones to return an array of the specified type, for example

          val = ones (n,m, "uint8")