09-05-2013 01:37 PM
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.
09-05-2013 01:45 PM
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,
09-05-2013 02:04 PM
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.
09-05-2013 02:41 PM
09-05-2013 03:02 PM
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,
09-05-2013 05:15 PM - edited 09-05-2013 05:25 PM
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.
09-06-2013 09:03 AM
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.
09-06-2013 10:32 AM - edited 09-06-2013 10:33 AM
Here is my (revised) solution.
09-06-2013 10:43 AM
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?
09-06-2013 12:52 PM
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,