Clear Filters
Clear Filters


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

How can I loop this

7 views (last 30 days)
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
Benjamin Thompson
Benjamin Thompson on 1 Feb 2022
You want to call a function every 10 minutes? Or are you reading in a file containing message data with time stamps and after every 10 minutes of time in the data you want to call a function? If you are processing messages from a data file please post a sample of the file.
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);
if linia(13)=='A' && linia(15)=='1'
sequencia = ais_to_bit(linia(15:44));
longitud = bin2dec(num2str(s_longitud))/600000; % en graus
lon1 = [lon1, longitud];
latitud = bin2dec(num2str(s_latitud))/600000; % en graus
lat1 = [lat1, latitud];
hope it helps

Answers (0)

Community Treasure Hunt

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

Start Hunting!