I want to plot latitude and longtitude.

1 次查看(过去 30 天)
Aike
Aike 2012-9-16
I have the data as shown below:
9.00000 -44.86 167.10 3.99
9.00833 -44.84 167.13 4.01
9.01667 -44.83 167.16 4.03
9.02500 -44.81 167.19 4.05
9.03333 -44.80 167.22 4.08
9.04167 -44.79 167.25 4.10
9.05000 -44.77 167.28 4.12
9.05833 -44.76 167.31 4.14
9.06667 -44.75 167.34 4.16
9.07500 -44.73 167.37 4.19
9.08333 -44.72 167.39 4.2
9.09167 -44.71 167.42 4.22
9.10000 -44.69 167.45 4.23
9.10833 -44.68 167.48 4.22
9.11667 -44.67 167.50 4.23
9.12500 -44.65 167.53 4.24
9.13333 -44.64 167.56 4.26
9.14167 -44.63 167.58 4.27
9.15000 -44.61 167.61 4.29
9.15833 -44.60 167.64 4.31
There are 4 columns and 20 rows. The first, second, third and fourth columns show Time, Latitude, Longtitude and the amount of plasma, respectively. I try to write an m file to plot latitude and longtitude using the code below:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
data = xlsread('hoki.xls'); %Import data
figure('Color','white')
latlim = [-50 -30];
lonlim = [160 180];
ax = usamap(latlim,lonlim);
axis off
hold on
geoshow('landareas.shp', 'FaceColor', [0.9 0.9 0.9])
for k = 1:20 %row 1 - 20
hok0 = [data(k,2) data(k,3)];
l = data(k,4);
if l >= 2 & l < 4
figure(k), plotm(hok0(1), hok0(2),'sr','MarkerFaceColor','r')
imwrite(0,map,'k.hdf','Compression','none',...
'WriteMode','append')
clf
elseif l >= 4 & l < 6
figure(k), plotm(hok0(1), hok0(2),'sb','MarkerFaceColor','b')
imwrite(0,map,'k.hdf','Compression','none',...
'WriteMode','append')
clf
else l >= 6 & l < 8
figure(k), plotm(hok0(1), hok0(2),'sy','MarkerFaceColor','y')
imwrite(0, map,'k.hdf','Compression','none',...
'WriteMode','append')
clf
end
end
My aim is to plot latitude and longtitude on New Zealand mab. The point coulours of lat and lon will be classified as the amount of plasma including red, blue and yellow. I try to control the program as the process below:
1) choose k =1: hok0 = [data(k,2) data(k,3)];
2) plot figure(1) using: figure(k), plotm(hok0(1), hok0(2),'sr','MarkerFaceColor','r')
3) export immage 1 using: imwrite(0,map,'k.hdf','Compression','none',... 'WriteMode','append')
4) close figure(1) using: clf
5) continue to plot figure(2) to figure(20)
There is an error while the program try to plot figure(2). help me please.
  1 个评论
Walter Roberson
Walter Roberson 2012-9-16
The first argument ti imwrite() must be the array of data to write. You are writing a scalar 0 each time.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by