LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview novice with a question about scanning strings

Hello, I'm a research assistant tasked with taking data received via TCP-IP and plotting it. I've had a couple of problems, probably because I've never used Labview before.

 

The data is sent in sets of six values separated using semicolons as delimiters, for example

"0.086842;0.00020341;0.00039838;-0.14057;-0.12614;-0.1327;" is one such data set

Receiving these strings through TCP connection is working just fine, however I just noticed that after passing a string such as my example into a 'Scan String for Tokens' block, the negative signs are dropped from the latter three values. I assumed it has something with setting '-' as an operator, but simply wiring negative sign in as an operator didn't change anything. I know there has to be a way to retain my negative signs, but I can't figure it.

 

 

0 Kudos
Message 1 of 7
(4,238 Views)

Is this what you need?

 

Download All
Message 2 of 7
(4,230 Views)

Yes! Thank you very much!

 

Your example brings up another question, though. When you pass those values into an array, is it possible then to pass individual array elements back out?

0 Kudos
Message 3 of 7
(4,208 Views)

if you're always sure that there are six elements in the array, you could use index array. Alternatively, instead of using the above function, use scan from string.

 

 

 Scan From String.JPG

Message 4 of 7
(4,200 Views)
Actually, I think I know the answer to that. An Index array block does that. Thanks again!
0 Kudos
Message 5 of 7
(4,196 Views)
Yep, thanks to you too, right after I posed the question I thought that. Thanks!
0 Kudos
Message 6 of 7
(4,195 Views)

You  should use a shift register to cancatenate succesive arrays to one big array.

I suppose you have a loop somewhere in your code, then add a shift register to it.

Right click on the loop and select "Add shift register"

 

Be sure to right click on the "Buid array" and select "Concatenate Inputs" or you will end up with a 2D array.

 

Message 7 of 7
(4,192 Views)