Info

This question is closed. Reopen it to edit or answer.

How can I loop this

1 view (last 30 days)
flashpode
flashpode on 1 Feb 2022
Closed: Cris LaPierre on 1 Feb 2022
I want to create a loop for when for all the messages that are in the variable of duration are within one rank that is going from one number to another. Let me explain with an example
my variable of duration goes from 00:00:00 to 23:59:59 I want to create a loop that runs my code when the time of the messages are first from time 00:00:00 to 00:10:00. Then from 00:10:00 to 00:20:00 (10 mins each time) till it reaches from 23:50:00 to 23:59:59
  2 Comments
flashpode
flashpode on 1 Feb 2022
I got a variable of data that is associated to the variable of time I got by the position. Its like: message 1 of variable X has his time in the position one of the variable of time. I want to run my code for all the messages that are from minute 00 to minute 10 then from minute 10 to minute 20 and this till the end.
I post the variable of time, the variable of data for the loop and the loop. What I need is to create this restriction.
lat1 = [];
lon1 = [];
L = size(msg_NoMatchAIS1,1);
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));
if
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
hope it helps

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by