08-07-2013 07:46 AM
Alrighty folks,
I am testing a number of samples and running the equipment and logging the data via Labview.
I am logging the data for all samples onto one spreadsheet. At the moment every time I run the code the data is stored in a new line on the spreadsheet, which is all good and well until I have to rerun a sample (let's say "sample A"), instead of replacing the current Sample A (let's say three tests after the re-test, i.e three rows have now been filled with Sample B, Sample C & Sample D) it just adds to the bottom of the spreadsheet file which is proving tedious to replace manually.
I understand that Labview will now have to do a read of the spreadsheet file and perform a comparison for each sample name previously stored with "Sample A" before writing it to the file. However as I am not proficient at Labview and my abilities to manipulate arrays is lacking.
This is where I am hoping someone can help me out. I've attached a sample of the data I collect in an excel file (the preferred means of viewing the data). As you can see the sample names are all in the first column and this is what is going to be compared to "Sample A."
to summarise I need a code that:
Thanks in advance for your help.
Solved! Go to Solution.
08-07-2013 07:58 AM
It would be much easier for us to help you if you could attach your LV code instrad of the finished spreadsheet. But, without any other information, I'd say that converting your array to a string and using one or more of the functions on the string palette before you store it as a spreadsheet could be an easy way to do what you want.
Cameron
08-07-2013 08:28 AM - edited 08-07-2013 08:33 AM
Here is the Sub VI I used to write the summary files.
when case false the multi-element code is run, which automatically runs samples A - Z.
When re-tests have to be done I want to use the single element code (Which is empty at the moment). And again this is where help is needed.
08-07-2013 10:24 AM - edited 08-07-2013 10:25 AM
OK. What this code will do is add a line with your new data (new Element Name) at the end of your data or replace the line which has the same Element Name at the point where it occurred originally. Then, when the WHILE loop is done, it writes it all to your spreadsheet file. Tabs and endoflines are added so when you write to the file, it recognizes them as cell and row delimiters. This way you don't have to decide where to put your latest measurements. It will take longer when you have a really big dataset, but so does everything .
Notice, it isn't a finished product, you will have to trigger and end the while loop (and put some timing in it, unless you make it event-driven) and add the other stuff (path, header, etc.) you had.
Avoid using those sequence frames - in your code, they were totally redundant.
Hope this helps,
Cameron
08-07-2013 10:32 AM
Cameron Thank you very much for your advice and help.
I should've mentioned I was using labview version 8.51...Alas I can't open what might be an incredibly useful VI.
Anychance of some screen shots.?
08-07-2013 10:44 AM
Let's see if this works:
(The True case in the CS above is simply a wire connecting in and out.)
One last thing I thought of, the \r\n strings (EOL) may need to be replaced with either \r or \n alone (strings shown in " \ Codes display " not normal display).
Cameron
08-09-2013 09:11 AM - edited 08-09-2013 09:12 AM
Hey Cameron, what does element name 2 refer to in the code?
08-09-2013 09:53 AM
Sorry, that should have been a wire back to the original "Element Name", like this:
What this does is replace any line which starts with the Element Name in your new input with your new line, effectively replacing the old data with the new. Then teh spreadsheet file is written only once, after everything is in the array.
Cameron
08-09-2013 10:50 AM
Ah I suspected so.
Also what is that final function before the loop closes called. I'm assuming it turns the string into an array but what is it called on Labview, I'm having a helluva time finding it
08-09-2013 10:53 AM - edited 08-09-2013 10:54 AM
Also in some cases the spreadsheet file will already be written with data in it, in that instance how would I compare what's already in the spreadsheet file with saved rows to a new test being added to the spreadsheet?