Get the time of the messages
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, I've got a code that gives me the messages that repeat from two different strings. What I want is to get the time from the those messages but when I do it I get an error. Here is the code:
for K = 1:1:N
all_match_AIS = find(msg_AIS1(K) == msg_AIS2); % encontrar mensajes iguales
if isempty(all_match_AIS) %fprintf para escribir datos en un archivo de texto
% fprintf('No hay coincidencias para la linia #%d -> "%s"\n', origi_AIS1(K), msg_AIS1(K)); % '%s' para un string
continue;
end
% fprintf('potencial coincidencia #%d -> "%s", checking times\n', origi_AIS1(K), msg_AIS1(K));
% disp(K), disp(all_match_AIS)
if H1(K)== H2(all_match_AIS)
% crear rango de coincidencia de minutos
complete_match_AIS = all_match_AIS(M1(K) == M2(all_match_AIS) | M1(K) == M2(all_match_AIS) - 1 | M1(K) == M2(all_match_AIS) + 1);% Rango creado +-1 minuto de cada mensaje
msg_match{K} = msg_AIS1(complete_match_AIS);
Time_Matching = Time_AIS1(msg_match(K)) % HERE I GOT THE PROBLEM IMPORTANTE
end
if isempty(complete_match_AIS)
% fprintf('line %#d -> "%s" coincide texto pero no tiempo\n', origi_AIS1(K), msg_AIS1(K));
else
% fprintf ('line %#d -> "%s" coincide tambien el tiempo. Los resultados son:\n', origi_AIS1(K), msg_AIS1(K));
msg_AIS2(complete_match_AIS) %IMPORTANTE
end
end
The problem I got is the next one:
Unable to use a value of type cell as an index.
Error in matlab.internal.datatypes.parenReference_1D (line 12)
data = data(rowIndices);
Error in duration/parenReference (line 19)
obj.millis = parenReference_1D(obj.millis, rowIndices);
Error in CodiVicens (line 41)
Time_Matching = Time_AIS1(msg_match(K))%coger los mensajes de las lineas que han coincidido. IMPORTANTE
Thank you in advance
0 commentaires
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!