09-05-2018 08:31 AM
I have a VI that is collecting data, and then writing it to a spreadsheet. The problem I am having, is that after each run it will add a new blank row at the top of the spreadsheet. The last run will have the data starting at row 2, row 1 is the name of the part tested, and then the part before that will have the data starting on row 3 part before that starting on row 4, and so on. The interesting thing though is that the name for each part is always on row 1, and it is only the data that is being moved down a row each run. In the snipped the disconnected line is the array of data collected.
09-05-2018 09:25 AM
Post your code, not a picture of a tiny piece of your code.
09-05-2018 09:43 AM
Here is a snippet of the state that does the capture and writing, as well as the entire VI.
09-05-2018 09:52 AM - edited 09-05-2018 10:00 AM
Why are you opening the file and reading into an array, adding in your new row, and then rewriting the entire file every time?
Use the Append function of the Write to Delimited spreadsheet vi to write successive rows of data to a file.
09-05-2018 09:58 AM - edited 09-05-2018 10:01 AM
Also DON'T open and close your VISA session every time your "Step" state runs.
Open the VISA session at the start of your program
Pass the VISA reference around the loop and to all of your states using a shift register
Close the VISA session at the end of your program
09-05-2018 10:08 AM
I actually just realized my mistake and fixed it. I forgot to zero the data array on reset. The reason for opening the file, reading, and adding the new data is that I want the data stored in columns rather than in rows, as it is much easier to read and compare that way.