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 exampleval = ones (n,m, "uint8")