09-08-2009 11:35 AM
By popular demand, the function/VI/control name has been added to the title. The VI for today is "Write to Spreadsheet File.vi". This is another classic one that is widely used and abused. It provides a very important functionality, but if you are a little adventurous you can do a lot better.
Really useful context help. Slightly better detailed help, until you notice it gives you the same detailed help for the different instances.
I really suggest you save a copy of this guy and build your own. I replace the one that ships, but officially that is probably frowned upon, so be sure to save a copy first.
Things that I tweak include the annoying default error handling, adding a string array for column labels, and different versions for different data types. Sometimes I am very careful to keep everything SGL and then at the final step, bang, this guy coerces it to DBL. Once you get under the hood, you will see this is a pretty straightforward VI, ripe for improvements.
One final note: This VI writes text files which are very easily opened in Excel, it does NOT write Excel files. Many forum questions spend about three iterations clearing this up.
Groundrules for VIOTD here.
09-08-2009 11:54 AM
Darin.K wrote:.....This VI writes text files which are very easily opened in Excel, it does NOT write Excel files.....
Yep. Perhaps they should have named it Write to Delimited File.vi
09-08-2009 11:59 AM
Darin.K wrote:By popular demand, the function/VI/control name has been added to the title. The VI for today is "Write to Spreadsheet File.vi". This is another classic one that is widely used and abused. It provides a very important functionality, but if you are a little adventurous you can do a lot better.
Really useful context help. Slightly better detailed help, until you notice it gives you the same detailed help for the different instances.
I really suggest you save a copy of this guy and build your own. I replace the one that ships, but officially that is probably frowned upon, so be sure to save a copy first.
Things that I tweak include the annoying default error handling, adding a string array for column labels, and different versions for different data types. Sometimes I am very careful to keep everything SGL and then at the final step, bang, this guy coerces it to DBL. Once you get under the hood, you will see this is a pretty straightforward VI, ripe for improvements.
One final note: This VI writes text files which are very easily opened in Excel, it does NOT write Excel files. Many forum questions spend about three iterations clearing this up.
Groundrules for VIOTD here.
Yes, that is my list of frequently used and modified VIs.
For the Noobs:
Many of the VIs you find that ship with LV and have an open diagram are OK to modify IF you first save the VI off as a new name outside of Vi.lib. Failure to do this first could put you in danger of loosing your work if LV is upgraded or repaired.
End of public service meassge.
Ben
09-08-2009 02:06 PM
09-08-2009 02:24 PM
Nice one (Darins annotations). If you are a professional in LV, start with modifying this one for a resusable lib, suited to your needs/standards. Even they are revised since my good old LV7.1.
Felix