%% Find Real Elements in Cell Array
% Create a cell array.

C{1,1} = pi;                 % double
C{2,1} = 'John Doe';         % char array
C{3,1} = 2 + 4i;             % complex double
C{4,1} = ispc;               % logical
C{5,1} = magic(3);           % double array
C{6,1} = complex(5,0)        % complex double

% C is a 1-by-6 cell array.
%
% Loop over the elements of a cell array to distinguish between real and complex elements.

for k = 1:6
x(k,1) = isreal(C{k,1});
end

x

% All but C{3,1} and C{6,1} are real arrays.
% Copyright 2012 The MathWorks, Inc.