07-30-2013 11:11 AM
Hey Everyone,
I am trying to write a program on LABView that records every temperature point on an excel spreadsheet every five seconds. However, I am trying to fix a header to the top of the file (which describes what each reading is). So far, I have managed to get the header to show up, but it keeps repeating. In addition, there is a space between all my recordings. This is more of an inconvenience than anything, but I would love it if someone could help me out in finding a fix for this too!
I have attached the relevant VIs - the excel program is in the case loop at the bottom.
07-30-2013 11:12 AM
I have also attached a sample excel readout
07-30-2013 11:19 AM
@tompkins92 wrote:
...that records every temperature point on an excel spreadsheet every five seconds. .
I don't see anything in your core that relates to excel. What a birds nest of wires!
07-30-2013 11:22 AM
Yes, I am trying to clean up my code a little. Apologies :). The main code relating to excel is at the bottom of the while loop, In the case structure.
07-30-2013 11:27 AM
I haven't looked at your code but check out the following post that deals with writing to excel. See if it helps any.
07-30-2013 11:29 AM
@aputman wrote:
I haven't looked at your code but check out the following post that deals with writing to excel.
He's writing to a plain delimited text file.
07-30-2013 11:44 AM - edited 07-30-2013 11:47 AM
You are writing your headers everytime you write your data.
You only need to write them once at the start outside your loop.
see attached...
07-30-2013 11:45 AM - edited 07-30-2013 11:52 AM
If you save your VI for 2009 I can open it and take a closer look.
As for the header, just write it to the file outside of any loops and before any of the results are recorded.
Assuming you append to the same file, it doesn't matter if you write the header right before the loop or 6 years before the loop ever takes place.
Example:
[-----------------------------------------]
[ ]
[ ]
[write header] ---> [ loop and record data ]
[ every 5 seconds ]
[ ]
[ ]
[-----------------------------------------]
As for the blank lines, you are likely writing empty strings with only a new line character to the file. This could be a result of writing faster than results are being computed, or you are wiring invalid strings to the Write to Spreadsheet File VI. Make sure that there will be a valid string before writing the results to file. If this is happeningin parallel, use some form of synchronization.