-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoastlin.m
More file actions
38 lines (30 loc) · 909 Bytes
/
coastlin.m
File metadata and controls
38 lines (30 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function coastline(elon,linetype)
% function coastline(elon,linetype)
%
% Script tool to plot world coastline on current plot if there is one.
% Otherwise, it draws a world plot. Data come coastline.dat (coarse).
%
% elon=0 for longitude axis -180 to 180
% elon=1 for longitude axis 0 to 360
% linetype '-w' default if not specified
% 15 Dec 1993 G.Lagerloef
if elon~=0 & elon ~=1, help coastline, error('Improper elon'),end
if nargin<2, linetype='-w'; end
[fid,msg]=fopen('coastline.dat');
if ~isempty(msg), error(msg), end
set(gca,'box','on');
hold on,
count=1;
while count,
a=fscanf(fid,'%i',2);
if isempty(a), return, end
b=fscanf(fid,'%f',[a(2),a(1)]);
if elon,
I=find(b(1,:)<0); plot(360+b(1,I),b(2,I),linetype),
I=find(b(1,:)>=0); plot(b(1,I),b(2,I),linetype),
else
plot(b(1,:),b(2,:),linetype),
end
end
fclose(fid);
% fini