| MATLAB Function Reference | ![]() |
Syntax
Y=ones(n) Y=ones(m,n) Y = ones([m n]) Y =ones(d1,d2,d3...) Y = ones([d1 d2 d3...]) Y =ones(size(A)) ones(m, n,...,classname) ones([m,n,...],classname)
Description
Y = ones(n)
returns an n-by-n matrix of 1s. An error message appears if n is not a scalar.
Y returns an = ones(m,n) or Y = ones([m n])
m-by-n matrix of ones.
Y = ones(d1,d2,d3...) or Y returns an array of = ones([d1 d2 d3...])
1s with dimensions d1-by-d2-by-d3-by-....
Y = ones(size(A))
returns an array of 1s that is the same size as A.
ones(m, n,...,classname) or ones([m,n,...],classname) is an m-by-n-by-... array of ones of data type classname. classname is a string specifying the data type of the output. classname can have the following values: 'double', 'single', 'int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', 'int64', or 'uint64'.
Example
See Also
| odextend | open | ![]() |
© 1994-2005 The MathWorks, Inc.