LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Finding the latest iteration of a test within data array

Greetings everyone. I hope someone can help with this. I've been struggling with it for days now. We have a Labview VI that scans thousands of Excel files and extracts a serial number and data point from the file. A report is created from the data that contains the model/serial #/test iteration, the serial # of the device in question, and the data value. The final report contains every test iteration found. I need to have a VI that takes that data array and creates a new one containing just the last iteration of the test. I have attached a small sample array that shows the data before and what it needs to be after. The multi-dimensional array can contain upwards of 1000-2000 entries

 

For example

 

Name of file                                       device serial #              voltage data

MODEL42i_1111111111_1                    ND1234                       -500

MODEL42i_1111111111_2                    ND1256                       -560

 

The _1 denotes the test iteration. In this case, I would want the output array to be:

 

MODEL42i_1111111111_2                    ND1256                       -560

 

This shows that serial number 1111111111 ran two times. The final device used was ND1256 with a voltage of -560. This entire entry would go into the output array.

0 Kudos
Message 1 of 15
(3,662 Views)

The Vi that you attache does not have any values in the control. You need to right click on the control and select go to Data operations and select make current value as default for the control to save the values you have entered.

 

As far as your question, if the final test result is the always the final row. get the size of othe array and index out the last row. If not you have to specify what indicates the final test results.

 

Dan,

0 Kudos
Message 2 of 15
(3,660 Views)

DOH!!!!

 

Sorry. Here you go.

 

Unfortunately, it is not always in that order. The software reads an entire directory and scans each file for a "PASS" flag. If found, it extracts the data and adds that file name and data to the array.

 

 

0 Kudos
Message 3 of 15
(3,652 Views)
To bad you did not use a database. Instead of thousands of files, you'd have one and a single query. Seems much more complex than it should be.
0 Kudos
Message 4 of 15
(3,643 Views)

Here you go.

This is just a quick and dirty way of showing you essentially what you need to do. You will have to put some effort into making it more efficient, mainly if you have exteremly large list coming in.

 

Good luck,

0 Kudos
Message 5 of 15
(3,636 Views)

There's a minor flaw when you have a serial number that has only one file.

[edit]

Of course my way had a similar flaw when confronted with only one file.

 

I turned the 2D array into a 1D array of clusters of data which I then sorted.  The last iteration would then be the last file before each serial number change and I based my selection on that.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 15
(3,616 Views)

Any chance you could repost the vi in Version 9? All this stuff is code and configurations that I inherited from another engineer that left the company. I'm new here and struggling to fix a lot of issues.

0 Kudos
Message 7 of 15
(3,595 Views)

Here is my (revised) solution.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 15
(3,584 Views)

I have a question for the LabVIEW gurus.  Is it better to init an array as I did, based upon the size of the original aray (since I didn't know what the final size was going to be, but it couldn't be bigger than the original) using subst array element and chopping off the extra elements, or not init the array and make a bunch of copies of data inside, using a build array?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 15
(3,578 Views)

It's better to initialize and then chop off the extra. When you initialize the array that's one copy being made, from there by using replace subset and you will modify the array in the same memory location. I believe array subset will dublicate the array in memory also but this is still more efficient. When you use Build Array, it creates a copy of the data every time, so basically you get the factorial affect. With amount of memory available now a days and a small array size, these advantages could be negligible. But if you start working with arrays with few thousand cells, on hardware that is resource restricted, this will make a significant difference.

 

As far as test files with only one sample, as long as there is a _# at the end it should work fine.

 

Hope this helped,

Message 10 of 15
(3,565 Views)