%% Define Complex Number with Zero-Valued Imaginary Part
% Use the complex function to create a scalar, A, with zero-valued imaginary part.

A = complex(12)

%
% Determine whether A is real.

tf = isreal(A)

% A is not real because it has an imaginary part, even though the value of the imaginary part is 0.
%
% Determine whether A contains any elements with zero-valued imaginary part.

~any(imag(A))

% A contains elements with zero-valued imaginary part.
% Copyright 2012 The MathWorks, Inc.