02-20-2009 10:23 AM
Hi guys,
i'm trying to log data to an excel file, i want to have multiple labled colums of data and write a new line of data every second. I have written a program to do this but i'm sure its not the best way.
Ideally i would like to write a line at a time, but the only way i can mannage to do it its to collect all the data into an array, transpose it and keep writing the array to the file, this means the data allready in the file is simply over written by its self comming from the array and the new data is written in, the array just gets bigger and bigger esentialy storing all the data the file is storing.
I have attached a picture of the table my program creates as this is the layout i want to achive, but i want to update it a line at a time.
Any ideas ,Thanks Zac.
02-20-2009 10:35 AM
02-20-2009 10:47 AM
I'm using the "write to spreadsheet file" vi.
I have attached a picture of this part of the program, the flat sequence has 3 sequences 1 and a half are off screen but number 1 creates a file and writes some one off details to it, number 2 creates the colum titles and number 3 is the main one in the picture which saves the data.
*I know its messy.
** the data comes from the main VI as this is a SubVi.
Chees, Zac
02-20-2009 11:08 AM
just to clarify, i have enabled the "append to file" option on the "write to spreadsheet file" vi, but the problem i have is my array is keeping all the data so when i write the array to file instead of appending a single line it appends a huge array full of data.
How can i update a single line array rather than simply adding to it ?
cheers zac
02-20-2009 11:18 AM
This appears to be the same program you asked about here and here.
If you're logging a new line at each iteration of the loop (it seems that you turn logging off/on with the Boolean control), then you do not need the previous information, so why are you trying to append to it? Are you trying to save the data in case logging is turned off, and then if logging gets turned back on, the data that didn't get written to file gets written? If so, what's the purpose of turning logging off? If you do not care about saving data while logging is turned off, then all of your shift registers are unnecessary, and all of the individual Build Array functions that are connected to your numeric controls are unnecessary. Simply take each numeric control into a single Build Array and feed that to the Write to Spreadsheet File function.
02-20-2009 11:18 AM
just been having a play and i've got it sorted, its painfully simple.
thanks zac
02-20-2009 11:20 AM
thanks, thats what i've just come to realise.