Skip to Main Content Skip to Search
Product Documentation

true - Logical 1 (true)

Syntax

true
true(n)
true(m, n)
true(m, n, p, ...)
true(size(A))

Description

true is shorthand for logical (1).

true(n) is an n-by-n matrix of logical ones.

true(m, n) or true([m, n]) is an m-by-n matrix of logical ones.

true(m, n, p, ...) or true([m n p ...]) is an m-by-n-by-p-by-... array of logical ones.

true(size(A)) is an array of logical ones that is the same size as array A.

Tips

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

See Also

false | logical

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS