LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

put elements into an array with certain sequence

I'm trying to process some serial port incoming string data, for example, <time stamp><tab><sensor1><:><data1><tab><sensor2><:><data2>...<sensor n><data n><CR>, however, each time the sequence of sensor might be random.

 

it could be <time stamp><tab><sensor N><:><data N><tab>...<sensor random><data random><CR>

 

I want to generate a data array with a  regular sensor sequence number. Something like,

 

time stamp | sensor1 | sensor2 | ... | sensor N |

time1           | data 1    | data2     | ... | data N     |

 

so far, I parse the whole protocol into small pieces of strings, now how can I assemble them back into an array with the regular sequence I defined?

 

Thanks!

0 Kudos
Message 1 of 3
(3,152 Views)

If you know how many sensors, use Initialize Array to make an array of 0s.  Then when you parse your strings, you figure out the sensor index and use Replace Array Subset to update that sensor's data.  Do this in a FOR loop.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 3
(3,138 Views)

First Frame the header (in the order as expected) and find the Number of sensors

 

Then find the values of appropriate header by string searching options and append them in the Column of corresponding Header

 

if possible share the code for Proper Solutions

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 3 of 3
(3,109 Views)