Skip to content

true

Logical array of all true.

A = true
A = true(n)
A = true(d1, d2, ...)

Creates a logical (boolean) array of all true. With no arguments, returns scalar true. With one integer, returns an n×n square; with multiple, an N-dimensional array.

true % logical scalar true
true(3) % 3×3 of true
true(1, 5) % row vector of five trues
  • false — Logical array of all false.
  • ones — Array of all ones.
  • islogical — Test whether the input is of logical (boolean) type.