Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Logical 1 (true)

`true`

`T = true(n)`

`T = true(sz)`

`T = true(sz1,...,szN)`

`T = true(___,'like',p)`

`true`

is shorthand for the logical value `1`

.

is
a `T`

= true(`sz1,...,szN`

)`sz1`

-by-`...`

-by-`szN`

array
of logical ones where `sz1,...,szN`

indicates the
size of each dimension. For example, `true(2,3)`

returns
a 2-by-3 array of logical ones.

`true(n)`

is much faster and more memory efficient than`logical(true(n))`

.