function hopsgui_realcoastline
%  This funnction add the real coast line to the plot.
%  In case the coast file do not exist there is a error message
%  Pedro Velez (UIB), July 1999


global hopsgui_obj

if exist('/usr3/users/pedro/Alboran/input_data/coastlines/med_cst.dat')==2
disp('...loading coastline')
load /usr3/users/pedro/Alboran/input_data/coastlines/med_cst.dat
else 
errordlg('Please edit the hopsgui_realcoastline.m file and change the coast file')
disp('>>>>Please edit the hopsgui_realcoastline.m file and change the coast file')
return;
end

xlim=get(hopsgui_obj{1}.haxes1,'xlim');
ylim=get(hopsgui_obj{1}.haxes1,'ylim');
yc=med_cst(:,1);
xc=med_cst(:,2);
indice=find(xc>xlim(2));xc(indice)=NaN;yc(indice)=NaN;
indice=find(xc<xlim(1));xc(indice)=NaN;yc(indice)=NaN;
indice=find(yc>ylim(2));xc(indice)=NaN;yc(indice)=NaN;
indice=find(yc<ylim(1));xc(indice)=NaN;yc(indice)=NaN;
indice=find(yc>990);xc(indice)=NaN;yc(indice)=NaN;
indice=find(xc>990);xc(indice)=NaN;yc(indice)=NaN;
indice=find(isnan(xc));yc(indice)=NaN;
indice=find(isnan(yc));xc(indice)=NaN;
nd=sum(~isnan(yc));
hold on;plot(xc,yc,'m');hold off
disp('>>>>Plotted coastline');

return;
