Help plotting two events that happened on the same day
Show older comments
Hello everyone,
I am currently with this code right here:
plot_avistagens = table(data_avistagens,lat_avistagens,lon_avistagens);
plot_tracking = table(data_tracking_tratado,lat_tracking_tratado,lon_tracking_tratado);
here is how plot_avistagens is organised (first column is datetime)
'27-Sep-2019' -24,1304300000000 -41,5916700000000
'27-Sep-2019' -24,1280000000000 -41,5905200000000
'29-Sep-2019' -25,2749500000000 -41,1169800000000
'30-Sep-2019' -25,3730300000000 -41,3620800000000
'30-Sep-2019' -25,3766300000000 -41,4046500000000
'30-Sep-2019' -25,3780300000000 -41,4305200000000
'30-Sep-2019' -25,3780300000000 -41,4305200000000
'30-Sep-2019' -25,2720800000000 -41,6465300000000
'30-Sep-2019' -25,1177000000000 -41,8814000000000
'01-Oct-2019' -24,4056700000000 -41,8560000000000
'01-Oct-2019' -24,4056700000000 -41,8560000000000
'09-Oct-2019' -24,6301200000000 -40,6946300000000
and here is plot_tracking (first column also datetime)
'30-Sep-2019' -24,2857830000000 -41,7407100000000
'30-Sep-2019' -24,2598050000000 -41,7166830000000
'30-Sep-2019' -24,2284610000000 -41,6914590000000
'30-Sep-2019' -24,1944140000000 -41,6667960000000
'30-Sep-2019' -24,1683580000000 -41,6296230000000
'30-Sep-2019' -24,1460220000000 -41,5832420000000
'01-Oct-2019' -24,1260030000000 -41,5351400000000
'01-Oct-2019' -24,1162640000000 -41,4840100000000
'01-Oct-2019' -24,1061480000000 -41,4380680000000
'01-Oct-2019' -24,0954680000000 -41,3900660000000
'01-Oct-2019' -24,0850860000000 -41,3420080000000
Now my next step is plotting different charts for each day. The difficulty I'm facing is: I need a chart that shows all the events that happened on each day. However, my code just plots "DayGroups day 1" with "DayGroups_t day 1" and doesnt check if "DayGroups day 1" is the same day as "DayGroups_t day 1"
D = findgroups(datetime(plot_avistagens{:,1}));
DayGroups = accumarray(D, (1:size(D,1))', [], @(x){plot_avistagens(x,:)});
Dt = findgroups(datetime(plot_tracking{:,1}));
DayGroups_t = accumarray(Dt, (1:size(Dt,1))', [], @(x){plot_tracking(x,:)});
for k = 1:size(DayGroups_t,1)
figure(k)
plot(DayGroups{k}{:,2}, DayGroups{k}{:,3:end}, 'bp', DayGroups_t {k}{:,2}, DayGroups_t{k}{:,3:end}, 'r:')
grid
end
That ends up plotting things from Sep-27 with things from Sep-30 and so on. Any ideas on how to fix this?
Thanks!
3 Comments
Star Strider
on 28 Oct 2019
Arthur Romeu
on 29 Oct 2019
Star Strider
on 29 Oct 2019
No worries!
I am just providing context.
Accepted Answer
More Answers (0)
Categories
Find more on Geographic Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!