%% Complex Vector with NaN
% Create a vector containing complex numbers and NaN values.

A = [NaN NaN 1+i 1+2i 2+2i 3+i];

%
% Check that the NaN elements are placed first within the vector, and that the remaining elements are sorted by real part.

issorted(A,'MissingPlacement','first','ComparisonMethod','real')

%
% Since the third and fourth elements of A have equal real part, issorted checks if the imaginary part of these elements are also sorted.

imag(A(3))

%

imag(A(4))

% Copyright 2012 The MathWorks, Inc.