eqlatlon=[35 -90; -30.5 -68; 0 0; 95 22; 45 370; -180 20; -50 -200; -55 -35; 45 -75]

disp('---------')
ell=eqlatlon;
ell(ell(:,1)<-90|ell(:,1)>90,1)=NaN
latlog=~isnan(ell(:,1))
disp('---------')
ell=eqlatlon;
ell(ell(:,2)<-180|ell(:,2)>360,2)=NaN
lonlog=~isnan(ell(:,2))
disp('---------')
%after two above  have to combine since in general both lat and lon will
%not be bad.
bothindx=latlog&lonlog
selected=eqlatlon(bothindx,:)

ell=eqlatlon;
disp('---------')
ell(ell(:,1)<-90|ell(:,1)>90|ell(:,2)<-180|ell(:,2)>360,1:2)=NaN
%use following to recover the row numbers of those without errors
%indicated by having NaNs and associating with the station names (that 
%should be in a cell, character, or string array.
[row col val]=find(~isnan(ell))
%this pulls out the rows without NaN (loose position in original)
goods=ell(~isnan(ell))
reshape(goods,length(goods)/2,2)