Do a loop with a restriction in a duration array

1 view (last 30 days)
Hi I've got a code I want to run it within a time. When the messages are inside a ran of time I want to run my code.
First I want to run all the messages that are in the first 10 mins then the messages that are within the min 10 and 20. This till the end of the duration variable(1 day).
I post the code and the variables:
lat1 = [];
lon1 = [];
D = minutes(0:10:1439);
D = duration(D,"Format","hh:mm:ss"); %this was created because I thought I could do it with this variable
a = length(D)
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_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
than you in advance
  4 Comments
flashpode
flashpode on 1 Feb 2022
Yeah, I upload a variable called Time that has all the diferent times from the messages

Sign in to comment.

Answers (0)

Categories

Find more on Characters and Strings 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!