Getting max and min in data from 1 hour every 5 mins

1 Ansicht (letzte 30 Tage)
flashpode
flashpode am 25 Apr. 2022
Kommentiert: flashpode am 25 Apr. 2022
Hi, I've got a code that gets me the lat and lon of each message of an hour, gets me the distance of each point and saves the max100. Every lat lon has a time arrival, how could I do the same but instead of everyr hour(one time per file) do it every 5 or 10 mins(I have the variable time already that has the minute and second of each message, so it would be divide the code for every 5 or 10 mins)
  2 Kommentare
Voss
Voss am 25 Apr. 2022
Can you share the code you already have?
flashpode
flashpode am 25 Apr. 2022
yeah so first thing the minut and the second of the message is in the name of the message so I extracted it the following way:
AIS1 = importfileAIS(thisfile1);
AIS1(strlength(AIS1) < 15) = [];
msg_AIS1 = regexp(AIS1, '.*(?=\d{4}$)', 'match', 'once');
t1 = regexp(AIS1, '\d{4}$', 'match', 'once'); %
then I code the lat and lon and calculate all the distances of the hour
lat1 = [];
lon1 = [];
for i=1:1:N
seq1 = AIS1(i);
linia=convertStringsToChars(seq1);
try
if linia(13)=='A' && linia(15)=='1'
sequencia = ais_to_bit(linia(15:44));
s_longitud=sequencia(62:89);
longitud = bin2dec(num2str(s_longitud))/600000; lon1 = [lon1, longitud];
s_latitud=sequencia(90:116);
latitud = bin2dec(num2str(s_latitud))/600000; lat1 = [lat1, latitud];
pos_lat = 1:numel(lat1); value_lat = lat1(lat1>50); index1 = pos_lat(lat1>50);
lat1(index1) = [];lon1(index1) = [];
pos_lon = 1:numel(lon1); value_lon = lon1(lon1>3); index2 = pos_lon(lon1>3);
lat1(index2) = []; lon1(index2) = [];
end
catch ME
disp(ME.message);
continue
end
end
%%Calculamos las distancias Max #1 y #100
NumLat1 = numel(lat1);
Total_Dist=cell(1,NumLat1);
for i = 1:1:NumLat1
loc1 = [lat1(i),lon1(i)]; loc2 = [41.3828 2.1857];
[~,Dist] = haversine(loc1,loc2);
Total_Dist{i} = Dist;
end
The point is that I want to get the highest distances every 5 or 10 mins

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Geodesy and Mapping finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by