08-04-2014 04:15 AM
Hi There
i am trying to save data using a write to spreadsheet file.vi whilst using multiple instances to write both a header and channel names.
The issue I am having is that I dont know how to only get the Header and channels to write only once whilst continuously updating the actual data.
I know i need a loop but am having difficulties as to where to locate the header and channel write commands due to not being able to place a loop in a loop as im trying to use this in a producer consumer architecture.
The actual data at the moment is saving like this;
Channel 1,Channel 2,Channel 3,Channel 4,Channel 5
26.695931 1264.239175 1265.031245 1263.931402 1264.283218 1265.603335 1265.295188 24.961623 1264.767105 1264.723050 1264.767077 1264.371149 1265.251065 1264.283201 1265.031094 1264.899071 1263.799468 1264.503094 1263.711894 653.372587
Test Name,Operator,UUT
Voltage Test,Nigel,AAA123
Channel 1,Channel 2,Channel 3,Channel 4,Channel 5
26.625061 1264.244430 1265.036502 1263.936655 1264.288472 1265.608592 1265.300445 24.928457 1264.772360 1264.728305 1264.772333 1264.376403 1265.256322 1264.288456 1265.036350 1264.904326 1263.804721 1264.508349 1263.717147 817.308725
Test Name,Operator,UUT
Voltage Test,Nigel,AAA123
Channel 1,Channel 2,Channel 3,Channel 4,Channel 5
26.701701 1264.245743 1265.037816 1263.937969 1264.289786 1265.609907 1265.301759 24.891822 1264.773674 1264.729619 1264.773647 1264.377717 1265.257636 1264.289769 1265.037664 1264.905640 1263.806034 1264.509663 1263.718460 818.468651
Test Name,Operator,UUT
Voltage Test,Nigel,AAA123
Channel 1,Channel 2,Channel 3,Channel 4,Channel 5
26.701701 1264.245743 1265.037816 1263.937969 1264.289786 1265.609907 1265.301759 24.854029 1264.773674 1264.729619 1264.773647 1264.377717 1265.257636 1264.289769 1265.037664 1264.905640 1263.806034 1264.509663 1263.718460 819.440776
Test Name,Operator,UUT
Voltage Test,Nigel,AAA123
Channel 1,Channel 2,Channel 3,Channel 4,Channel 5
26.704009 1264.248370 1265.040444 1263.940595 1264.292413 1265.612535 1265.304387 24.931925 1264.776302 1264.732247 1264.776274 1264.380344 1265.260264 1264.292396 1265.040292 1264.908268 1263.808661 1264.512291 1263.721086 820.826856
Test Name,Operator,UUT
Voltage Test,Nigel,AAA123
Channel 1,Channel 2,Channel 3,Channel 4,Channel 5
26.666267 1264.248370 1265.040444 1263.940595 1264.292413 1265.612535 1265.304387 24.894134 1264.776302 1264.732247 1264.776274 1264.380344 1265.260264 1264.292396 1265.040292 1264.908268 1263.808661 1264.512291 1263.721086 822.360773
Thanks
08-04-2014 04:53 AM
Include some information in the queue data about the start of a new measurement. The evaluate that information in the writing case and write only a header if needed.
Regards, Jens
08-04-2014 05:40 AM
I would not suggest Write to Spreadsheet file.vi to be used inside a loop, since it opens and closes file whenever you execute it. Instead use the write to text file primitive by converting the data to string and converting that to a spreadsheet string. In one case write the header value and then execute data writing in another case. Post your code for a clean suggestion.
08-04-2014 08:17 AM
It appears that you may have a state machine or something similar. Split the Write to File state into two states: Write Header to FIle and Write Data to File. Then call Write Header one time for each file and Write Data as often as needed.
Lynn
08-05-2014 02:05 AM
Hi P@Anand
Thankyou for your reply after a few iterations i have come up with this solution to my problem
Although i didnt use the write to text and then convert i can work on that now I have something working.
Thankyou for your input its always appreciated.
08-05-2014 07:15 AM
There is no way to tell from that pciture what you did (what's in the other case? what else is there? Why all these local variables?)
Overall, seems like way too much convoluted code.
08-13-2014 11:57 AM
08-13-2014 12:18 PM
Please attach the VI. We cannot debug pictures.
08-13-2014 09:48 PM
On a side note, I wish that write to spreadsheet file would just be scrapped. It causes more problems than it's worth. Just teach people from the start the proper way to do File I/O, don't abstract away open write and close all into a single VI.
08-14-2014 02:37 AM
Heres the main VI with its additional sub VIs attatched
Sorry I dont know how to compile the whole project and upload that so some of the other sub VIs called on will be missing mainly the averaging ones.