LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Look up string from numbered array element.

Solved!
Go to solution

This is my first post, so I will probably miss some thing or other.  I will address anything missed ASAP. I am writing LV code to test incremental count stored in a CSV text file. Counts represent stimulated current of a diode in a radiation beam. The product is a QA device for a medical radiation therapy machine. An integrator's output proportional to the diode current accumulates as integer counts in the text file. My LV code puts the counts into arrays, calculates time derivative incrementals and statistically analyzes them. The data array's column numbers represent unique components. The failing data column number is sorted into a 1D array of failing column numbers. As if failing column 10 represents CR39 of PCB 11. I need an algorithm how to relate a string such as CR39-PCB11 to either the element of the 1D failure array or relate the string to the column of the data array that fails. Could you suggest a way to do this?

 

 

Greg
0 Kudos
Message 1 of 12
(3,711 Views)
If the structure of the string is rigid I'd start by checking out the Scan from String function.  If you are unfamiliar with format strings, right-click and choose Edit Format String and it will walk you through the process.  In your case you'd match a string/number/string/number.
0 Kudos
Message 2 of 12
(3,706 Views)

Could you attach a small example CSV file, just so I can see how everything is formatted.

Cory K
0 Kudos
Message 3 of 12
(3,691 Views)

Have a look at the spreadsheet string to array function. You propably need to set the delimiter to ','.

 

Felix 

0 Kudos
Message 4 of 12
(3,685 Views)

CSVroadmap.png screenshot with comments.

moviedata_sums.txt is the CSV file.

Greg
Download All
0 Kudos
Message 5 of 12
(3,664 Views)
I notice that I called the data accumulated but the screenshot is incrementals.  I will post a CSV file of accumulated counts.
Greg
0 Kudos
Message 6 of 12
(3,660 Views)

My bad.  Posted is a screenshot of the vi after testing moviedata_sums.txt.  In the CSV file, columns of data alternate between the 2 up's and at a glance do not look as if accumulating.  The summing of each column E, F... is seen by sorting the even rows and odd rows into separate arrays.

Greg
0 Kudos
Message 7 of 12
(3,647 Views)

Sorry, I don't get where you're stuck.

 

Felix

0 Kudos
Message 8 of 12
(3,631 Views)

In the attached screenshot, my code found zero value updates in the Odd Data Array at columns 36, 132 & 137.  I am asking for ideas on how to call up a corresponding component ref designation string for the failed data.  If a column number is added to the failure array, I want to display a component ID tag for replacement.  Currently the tech uses a lookup table.   

 

Greg 

Greg
0 Kudos
Message 9 of 12
(3,606 Views)
Solution
Accepted by topic author gregarious-greg

If I understand you correctly, instead of those numbers that are in the 'Zero Updates(odd)' you want to have strings. At the moment, the operator is using a lookup-table, to find the string (component) which corresponds to the column number.

 

That's easy, as you only need an array of strings (corresponding to column numer 0..n) and use the index array function with the index of the column. Place it in a for loop to get all indices of the failures (autoindexing of the for loop).

 

Felix

0 Kudos
Message 10 of 12
(3,591 Views)