GeodataLogger via Matlab with plot_google_map

3 次查看(过去 30 天)
I am working on a project which requires geodata logging via Matlab, I want it to plot big red dots when acceleration on z-axis goes above 410, and plot normal size blue dots when acc_z value is below 410. I am using plot_google_map function for plotting google maps image.
Here is my code:
lat = [48.8708 51.5188 41.9260 40.4312 52.523 38.274179];
lon = [2.4131 -0.1300 12.4951 -3.6788 13.415 27.074541];
acc = [333 327 405 ; 334 327 440 ; 327 323 412 ; 325 321 425; 325 320 430; 400 400 400];
acc_z=acc(:,end);
i=1:length(lat);
k=1:length(lon);
j=1:length(acc_z);
raw_data=[lat ;lon ;acc_z'];
raw_data_acc=raw_data(3,:);
for m=1:length(j)
if (raw_data_acc(j))>410
plot(lon,lat,'.r','MarkerSize',40)
hold on
else
plot(lon,lat,'.b','MarkerSize',20)
end
end
plot_google_map
and here is my plot:
as you can see 2nd,3rd,4th and 5th dots must be big,red. But unfortunately i am not able to plot them as i want.
Any kind of help is appreciated.

采纳的回答

Chad Greene
Chad Greene 2016-3-25
I think your whole script can be replaced by this:
lat = [48.8708 51.5188 41.9260 40.4312 52.523 38.274179];
lon = [2.4131 -0.1300 12.4951 -3.6788 13.415 27.074541];
acc = [333 327 405 ; 334 327 440 ; 327 323 412 ; 325 321 425; 325 320 430; 400 400 400];
%
% Get indices 3rd column of acc values greater than 410:
bigthan410 = acc(:,3)>410;
%
% Plot the big ones as big red dots:
plot(lon(bigthan410),lat(bigthan410),'.r','MarkerSize',40)
hold on
%
% Plot the non-big ones as smaller blue dots:
plot(lon(~bigthan410),lat(~bigthan410),'.b','MarkerSize',20)
%
plot_google_map

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Mapping Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by