Make a code that makes a couple of times mine

1 view (last 30 days)
vicente Noguer
vicente Noguer on 4 Nov 2021
Hi, so my code is:
mmsi_selected = 218776000;
lat1 = [];
lon1 = [];
for i=1:1:L
seq1 = msg_NoMatchAIS1(i);
linia=convertStringsToChars(seq1);
if linia(13)=='A' && linia(15)=='1'
sequencia = ais_to_bit(linia(15:44));
s_mmsi=sequencia(9:38);
mmsi= bin2dec(num2str(s_mmsi));
if mmsi == mmsi_selected
s_longitud=sequencia(62:89);
longitud = bin2dec(num2str(s_longitud))/600000; % en graus
lon1 = [lon1, longitud];
s_latitud=sequencia(90:116);
latitud = bin2dec(num2str(s_latitud))/600000; % en graus
lat1 = [lat1, latitud];
end
end
end
lat2 = [];
lon2 = [];
for j=1:1:J
seq2 = msg_NoMatchAIS2(j);
linia=convertStringsToChars(seq2);
if linia(13)=='A' && linia(15)=='1'
sequencia = ais_to_bit(linia(15:44));
s_mmsi=sequencia(9:38);
mmsi= bin2dec(num2str(s_mmsi));
if mmsi == mmsi_selected
s_longitud = sequencia(62:89);
longitud = bin2dec(num2str(s_longitud))/600000; % en graus
lon2 = [lon2, longitud];
s_latitud = sequencia(90:116);
latitud = bin2dec(num2str(s_latitud))/600000; % en graus
lat2 = [lat2, latitud];
end
end
end
latFacu = 41.3828; %coordenadas facultat
lonFacu = 2.1857;
figure(1)
geoscatter(lat1, lon1)
hold on
geoscatter(lat2,lon2)
geoscatter(latFacu,lonFacu,1000000,'red')
legend('AIS1','AIS2')
hold off
That gives me all the messages from mmsi_selected (that it is a number from a list I got) and the shows it to me in a figure. What I want is to do all of this but for a list of different mmsi. And draw it in the same figure but different graff. I do not know how to do it because every mmsi has a different lat and lon so... Ask if you want some data to work with.
thank You

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!