LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array of strings to multiple string controls

I'm parsing a query response from a noise generator - it comes back as "1234,2345,3456,4567,5678,6789,7890,8901,9012,0123".  Basically, one long string of 10 4-digit values, comma separated, is returned.  Using the string Match :Pattern (in a loop) I've parsed the large string into an array of 10 4-digit strings without commas.  Now, I have 10 indicators (each representing one of the 10 values) that I want this info to go into.  I could (one-by-one) stuff the array information into each of these indicators.  However, I'm wondering if there is a loop-ish approach where maybe all the indicators get grouped into a cluster and the cluster order is the iterator that indexes into the source array. 
 
Any suggestions?
0 Kudos
Message 1 of 4
(2,507 Views)
You could use Spreadsheet String To Array to get an array of numbers, and then Array To Cluster to build a cluster from that.  Several considerations though.. If there is a blank field (2 delimiters in a row), the output would be 0.  Also it will output an array with as many elements as it can parse from the input string.  But since you specify a cluster size in Array To Cluster, your cluster would always be the right size though, so maybe not so much of an issue?
 
Here's an example anyhow..
 
 
0 Kudos
Message 2 of 4
(2,502 Views)
Maybe you can just use a plain array indicator directly. Anything wrong with that? It reduces diagram clutter! 🙂 You can always add free text labels outside as fake element labels.
 
If your indicators are scattered all over the front panel, use a single "index array", resized to 10 elements.
 
The attached example (LabVIEW 8.0) shows both ways.
0 Kudos
Message 3 of 4
(2,494 Views)

And as a third option (although I would personally prefer any of the other two) you can create a reference for each control, build them into an array and auto-index that array and the array of strings in a for loop and use the Value property to set the strings.

This is good mainly if you don't want to use a cluster or array, but even in this case, I would probably use Altenbach's Index Array method.


___________________
Try to take over the world!
0 Kudos
Message 4 of 4
(2,474 Views)