Hi,
I am reading log file which contains huge data
Timestamps Bus MsgId
1.8963 1 CFF8027x Rx d 8 0C 00 01 FC FD F0 0F 00
1.8966 1 CFFB027x Rx d 8 FC FF FF D3 FC FF FF FF
1.8967 2 CFE6CEEx Rx d 8 FF FF FF FF 00 00 00 00
1.8967 3 18ECFF27x Rx d 8 20 12 00 03 FF EC FE 00
1.8972 2 CFFB027x Rx d 8 FC FF FF D3 FC FF FF FF
1.8973 3 CFE6CEEx Rx d 8 FF FF FF FF 00 00 00 00
The above is example of data
There are 4623509 lines of data
Bus with number 1 is red
Bus with number 2 is yellow
Bus with number 3 is green
I read the data using Readalllines and using constructor with 3 objects to save timestamps,bus and msgId
CANMsgIdList.Add(new MsgIdTimeStampMap(CANBus, CANMsgId, timeStamp1));
MsgIdTimeStampMap is my constructor with 3 objets
I also deleted the repeated msgids using .Distict method
Now I am trying to find the messages passing from red to yellow with same msgId and different bus without passing to green or other in between
int p = 233;
for (int i = 0; i < CANMsgIdList.Count; i++)
{
for (int k = 0; k < CANMsgIdList.Count; k++)
{
if ((gatewayRYmsgId[p] == CANMsgIdList[i].MsgId)
&& (CANMsgIdList[i].Bus).Equals(ConsoleApplication13.Buses.CANBusRed)
&& (gatewayRYmsgId[p] == CANMsgIdList[k].MsgId)
&& (CANMsgIdList[k].Bus).Equals(ConsoleApplication13.Buses.CANBusYellow))
{
{
gatewayRtimeStamp.Add(CANMsgIdList[i].TimeStamp);
Console.WriteLine(gatewayRtimeStamp[j]);
Console.ReadKey();
j++;
}
}
}
}
I am getting error at line
if ((gatewayRYmsgId[p] == CANMsgIdList[i].MsgId)
&& (CANMsgIdList[i].Bus).Equals(ConsoleApplication13.Buses.CANBusRed)
&& (gatewayRYmsgId[p] == CANMsgIdList[k].MsgId)
&& (CANMsgIdList[k].Bus).Equals(ConsoleApplication13.Buses.CANBusYellow))
Error:Index out of range
But I do not understand. wy this error???
Thanks
John