You might encounter problems when removing values from array because the dimensions must be consistent
M = [ 1.23 1.34-4i 275-5i 4; 1.56 1.67 3-3i 5-6i];
MM=M; %don't overwrite your original data
MM(imag(M)~=0)=NaN %replace values with imaginary parts
%apply your code to MM, the NaN values are ignored by the plot function
plot(MM)