iscomplex

Determines if x is a complex value.

Syntax

R = iscomplex(x)

Inputs

x
Any valid scalar | string | vector | matrix
Type: double | integer | char | string | logical | struct | cell
Dimension: scalar | string | vector | matrix

Outputs

R
Boolean value true or false.

Example

Various inputs:

R = iscomplex(-5)
R = iscomplex(2i-3)
R = iscomplex([1,4;1,8])
R = iscomplex([1+8i, 9i-2; 8, i])
R = 0
R = 1
R = 0
R = 1