12-09-2014 04:02 PM
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
Solved! Go to Solution.
12-09-2014 04:07 PM
@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.
12-09-2014 04:15 PM
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
12-09-2014 05:15 PM
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.
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
12-09-2014 06:35 PM
@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.
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
12-10-2014 01:48 AM - edited 12-10-2014 01:52 AM
@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)