ones

Creates an matrix made of ones.

Syntax

  • R = ones

  • R = ones(n)

  • R = ones(n, m)

  • R = ones(n, m, ..., z)

  • R = ones(n, m, ..., z, 'like', V)

  • R = ones(n, m, ..., z, classname)

Input argument

  • n - a variable: n-by-n matrix

  • m - a variable: n-by-m matrix

Description

ones returns a matrix made of ones.

Examples

ones(3,2)
ones(3,1,3,'single')
A = single([3 3])
B = ones(2,4,'like', A)
tic(); single(1) * ones(1000); toc()
tic();ones(1000,'single'); toc()

See also

eye, zeros.

History

Version
Description

1.0.0

initial version

Author

Allan CORNET

Last updated