Skip to content

isreal

Element-wise real-type test.

TF = isreal(A)

Returns true for elements with no imaginary part (or imaginary part exactly zero). Counterpart of iscomplex.

Note: a value with imaginary part 0+0i is technically complex-typed but isreal returns true for it. Use iscomplex for a strict type check.

isreal([1 2+1i 3]) % [1 0 1]
  • iscomplex — Element-wise complex-type test.
  • real — Real part of a complex number.
  • imag — Imaginary part of a complex number.
  • isrealint — Element-wise real-integer test.