LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to displayed parced data

Solved!
Go to solution

Ok, Im having a little trouble with getting data to display in labview. I am reading from a seral string of data that is delimeted with ",". This works fine and I can out put the token stringn. After 7 "chunks"  of data, it will start to repeat itself. How can I get it to display each of these 7 chuncks of data and then on the next loop refersh them. 

 

This is all I have so far

 

 

0 Kudos
Message 1 of 6
(3,060 Views)

@KatherineNSCC wrote:

Ok, Im having a little trouble with getting data to display in labview. I am reading from a seral string of data that is delimeted with ",". This works fine and I can out put the token stringn. After 7 "chunks"  of data, it will start to repeat itself. How can I get it to display each of these 7 chuncks of data and then on the next loop refersh them. 

 

This is all I have so far

 

 


When you say 7 "chunks" do you mean 7 reads?

 

Also, I would recommend using spreadsheet string to array in this case instead of scan string for tokens. 

0 Kudos
Message 2 of 6
(3,049 Views)

By chunks I mean the seral data string I am sending LabView has 7 different measruments from a sensor. Each group of 7 is the newest measurment, if that makes more sence. I will take a look at spreadsheet string to array

0 Kudos
Message 3 of 6
(3,043 Views)
Solution
Accepted by topic author KatherineNSCC

If I understand the problem, you have a string that has a number of embedded commas, and you want an array of strings corresponding to the "stuff" between each comma.  Your reference to 7 "chunks" might imply that each VISA read will return a string of the form x1,x2,x3,x4,x5,x6,x7 (i.e. 7 items, 6 commas), but this solution doesn't care how many "chunks" there are, just that they are comma-separated.

Parse String.png

It uses the Match Regular Expression function, with the comma as the Regular Expression.  This VI basically splits the string into two parts, everything before the comma (the upper output, brought out as an array element) and everything else (lower output, put on a Shift Register to be run through again).  Each pass through the While loop pulls off another element, adding it to the array.  When nothing is left, the loop stops.

Consider three odd cases -- string with no comma (get an array of 1 element with the entire string, correct), string starting with a comma (get an array whose first element is an empty string, correct), string of 1 element, ending (or not) with a comma (get an array of 1 element, correct).

Enjoy.

 

BS

Message 4 of 6
(3,019 Views)

@Bob_Schor wrote:

If I understand the problem, you have a string that has a number of embedded commas, and you want an array of strings corresponding to the "stuff" between each comma.  Your reference to 7 "chunks" might imply that each VISA read will return a string of the form x1,x2,x3,x4,x5,x6,x7 (i.e. 7 items, 6 commas), but this solution doesn't care how many "chunks" there are, just that they are comma-separated.

Parse String.png

It uses the Match Regular Expression function, with the comma as the Regular Expression.  This VI basically splits the string into two parts, everything before the comma (the upper output, brought out as an array element) and everything else (lower output, put on a Shift Register to be run through again).  Each pass through the While loop pulls off another element, adding it to the array.  When nothing is left, the loop stops.

Consider three odd cases -- string with no comma (get an array of 1 element with the entire string, correct), string starting with a comma (get an array whose first element is an empty string, correct), string of 1 element, ending (or not) with a comma (get an array of 1 element, correct).

Enjoy.

 

BS


That does just what I needed!! Thank you 

0 Kudos
Message 5 of 6
(2,999 Views)

@KatherineNSCC wrote:
That does just what I needed!! Thank you 

Seems overly complicated. It has already been mentioned that "spreadsheet string to array" is the right tool here (comma delimiter, %s format, 1D string array as type) . No loop needed.

 

See attached VI. (Image shows that the results are the same for the two versions)

 

 

Download All
Message 6 of 6
(2,976 Views)