Display plotted "if loop" data in a worldmap?

조회 수: 1 (최근 30일)
Philipp Henschel
Philipp Henschel 2017년 12월 21일
답변: Philipp Henschel 2018년 1월 24일
I'm working a dataset containing Lat&Lons of multiple flightroutes. I'm plotting these into a figure, since the number of routes varies, using an if-loop plot :
figure()
for ii = 1:length(a.asdiflightplanid)
k=find(b.asdiflightplanid == a.asdiflightplanid(ii));
plot(b.longitude(k), b.latitude(k))
hold on;
end
now I want to plot these into a worldmap (USA) using the Mapping Toolbox:
worldmap([Minimal_LATPC-10 Maximal_LATPC+10], [Minimal_LONPC-5 Maximal_LONPC+5])
getm(gca,'MapProjection');
geoshow('landareas.shp','FaceColor',[224/256 224/256 224/256]);
geoshow('worldlakes.shp','FaceColor',[117/256 217/256 242/256]);
geoshow('worldcities.shp','Marker','.','MarkerEdgeColor',[118/256 122/256 121/256]);
the Minimum and Maximimu of Lat&Lon are defined before by the Lat&Lons used in the if-loop plot. But all my tries failed and mostly as a result either just receive an map of the US (geoshowing land, cities etc.), or my flightroutes in a Cartesian coordinate system, or an Error Message that I cannot combine these two plot (especially while using "plotm"). Any suggestion how I can combine these two?
Any help would be appreciated! Thanks

채택된 답변

Philipp Henschel
Philipp Henschel 2018년 1월 24일
Found a solution by myself using the ismember function & creating a table with just the rows i need
A = b(ismember(b.asdiflightplanid, a.asdiflightplanid),:);
and then using geoshow
geoshow(b.latitude, b.longitude);

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by