04-03-2013 03:04 PM
Hello,
I'm working on a program in Labview that should read Data, make it on an array and tranfer it in real time to an Excel file. I have already done that however there are some problemes i could'n solve so i'm here to share them with you and help fixe them if possible :
1) The excel file i'm using to write in has some functions defined on it, used to make calculations with transfered values and each time i run
my program every thing on the the file is overwritten even functions.
2) I have have to specify the rows/colums where i need to write (ex: start with row 4 column C to row 20 column C and jump colum B and row 14 and 15)
3) the VI need to be saved automatically, i did everytnig i've found on the NI forum but still not working.
I guess this is not easy to do but i really need some help so i can carry on my work.
Thank you
MGarry
Solved! Go to Solution.
04-03-2013 03:18 PM
Post the code you are using to write to excel and the excel file you're starting with. Make sure to highlight the cells in excel where you are writing the data.
04-03-2013 03:23 PM
Thanks Wayne for the reply, you'll find the code and the Excel file.
MGarry
04-03-2013 03:53 PM
Maybe you'll have to test it with a simple Excel file and see.
MGarry
04-03-2013 03:59 PM
If I understand correctly, you take a data sample once every hour over a period of time. That sample is then transfered to the excel sheet which includes an equation to average every 8 samples. Is that correct? Is the program intended to transfer each sample to Excel as it is taken and add it to the table on the front panel as well?
04-03-2013 04:07 PM
You've got it right Wayne, and having the samples on the front panel is useful in case i want to modify some values.
MGarry
04-03-2013 04:17 PM
Does Excel need to remain open for the duration or should it be saved/closed after every sample is added?
04-03-2013 04:29 PM
It has to be opened and saved after every sample is added during all the month (then i'll replace the old Excel file by the new one) so we can see every row written in the file and also be able to make sure changes we make take place effectively, there are also some columns (blue) with equations.
MGarry
04-03-2013 04:54 PM
It sounds like you need a state machine. Program starts up, opens a new excel file, takes a data point ( 1D String Array) and adds the new data to the table on FP and to the Excel file at a predetermined row and column. Excel file is saved and closed. Program waits a set period of time and then takes another data point. Data added to table and written to next row in Excel.
Every 8 samples/rows a row is skipped so the calculations are not overwritten. State machine also keeps track of when a new Excel file should be created.
04-03-2013 05:06 PM - edited 04-03-2013 05:08 PM
There is no need to create a new Excel file since i'm working with a specific one, also the Excel file has to be opened all the time, you said something about writing to a predetermined row/column do you mean that samples are intended to cells not to rows? because if it's so i'll have a big trouble to do it because there are too many samples to add.
Is this program useful somehow to perform a state machine ?
MGarry