# Ismember and ways to implement it

1 view (last 30 days)
flashpode on 15 Sep 2021
Commented: flashpode on 15 Sep 2021
Hey,I have two strings where every message from there has an arrival time. I have to compare the Messages from S1 with S2(strings both), as they are very big to compare with ismember I have to do it another way. Compare the first message from S1 with all the messages from S2 that came at the same time or 1 min before and after. Imagine one message from S1 has arrived at 5 min 40 sec. it should be compared with the message from S2 that came from the minut 4:40 and 6:40. The code that gave me the time from each message is:
N = size(AIS1,1)
p = size(AIS2,1)
TimeAIS1 = [];
TimeAIS2 = [];
for i=1:1:N
seq1=AIS1(i);
TimeAIS1 = [TimeAIS1,extractAfter(seq1,strlength(seq1)-4)];
DN = str2double(TimeAIS1);
dur1 = minutes(floor(DN/100)) + seconds(mod(DN,100));
end
for j=1:1:N
seq2=AIS2(j);
TimeAIS2 = [TimeAIS2,extractAfter(seq2,strlength(seq2)-4)];
DN2 = str2double(TimeAIS2);
dur2 = minutes(floor(DN2/100)) + seconds(mod(DN2,100));
end
flashpode on 15 Sep 2021
Yes, thats it using inmember but with the restriction that I explained of the last 4 digits