ones

Purpose

Create vector or matrix of all ones.

Synopsis

Y = ones(n)
Y = ones(m,n)
Y = ones(size(A))

Description

Y = ones(n) is an n-by-n matrix of 1s.

Y = ones(m,n) is an m-by-n matrix of 1s.

Y = ones(size(A)) is the same size as A and consists of all 1s.

See Also

eye, rand, randn, zeros

(c) Copyright 1994 by The MathWorks, Inc.