|
Hi everyone!
I need to read a large data stream (up to 4 million rows). The data stream consists of "frames" with variable length. There's no "end of frame" character in between.
The first byte gives you the number of messageID in the first frame, then there are 2 bytes for that ID, one byte for the length of the data field and then the data itself. This is repeated until all IDs of a frame are done. Then it all starts again with the number of messageIDs in the next frame.
Here's an example:
2 there are 2 messages in this frame (frame 1)
1 HEX ID of message, part one
1 HEX ID of message, part 2
4 length of data field
255 data
255 data
255 data
255 data
2 HEX ID of message, part one
2 HEX ID of message, part 2
3 length of data field
127 data
127 data
127 data
1 there is 1 message in this frame (frame 2)
3 HEX ID of message, part one
3 HEX ID of message, part two
6 length of data field
64 data
64 data
64 data
64 data
64 data
64 data
So I would like to sort it in a way that every message is put in a row and the frame nr is added:
ID1 | data field length | data | FrameNr 1
ID2 | data field length | data | FrameNr 1
ID1 | data field length | data | FrameNr 2
So far I can do this with nested loops...but as u know this takes forever. Unfortunately I don't know any solution to this due to the variable length of the messages/frames.
Do I have to implement this with mex?
Thanks a lot!
Volker
|