I'm starting with an IntPtr to structured data from a hardware source that sends periodic packets. A thread copies a packet from the Intptr buffer and places byte[] into a queue. Later the queue is read and byte[] is converted to a structure using this answer and becomes a collection (array) of type Packet.
struct Packet {
long time;
int field1;
short field2;
}
Packet[] array_of_packet;
Without duplicating the structure definition, I would like to use the data as if it was a structure of arrays.
struct ArrayOfPacket {
long[] time;
int[] field1;
short[] field2;
}
ArrayOfPacket data;
This format allows other functions use them as vectors:
Plot(data.time, data.field1);