10-28-2009 09:29 AM
One of the areas of the palettes that has changed significantly through the years is the File I/O portion. We used to have to sift through Write to IThis or IThat or Whatever. Now we have today's function "Write Text to File" and its cousin "Write to Binary File". Many times I use the binary version, even for text, but there is one feature of Write Text to File that I like and use now and then. Let's say you are generating an array of strings and you would like to output the results to a text file. There are many ways to do this, here are a few I thought of this morning.
I have never done the hard way, but it is what would go on in Write To Spreadsheet File if it accepted strings. I started out with the slightly ugly way and eventually used the concatenate strings method once I had read the help. Then I discovered that Write Text to File will accept 1D arrays, and now there is no going back. My only complaint about the function as-is is the use of an unwired terminal to trigger a dialog. I have to place a second VI which checks for an empty path (my usual signal) to trigger a file dialog and always pass a refnum to this VI. I wish I knew exactly what the consideration was for this choice (performance, likely error condition) so I could weigh it against the cost of the extra subVI.
VIOTD groundrules here.
10-28-2009 09:52 AM
Darin.K wrote:
I have never done the hard way, but it is what would go on in Write To Spreadsheet File if it accepted strings.
Write to Spreadsheet File does accept strings. At least in the more recent versions of LabVIEW.
10-28-2009 09:55 AM - edited 10-28-2009 09:58 AM
Good old polymorphism. Still the same dirty work, just letting someone else do it.
And that happens to be the exact reason for this exercise: I get stuck in my old habits and by forcing myself to reexplore areas I thought I knew, I learn something. Although, my goal is to learn one new thing each day, I am getting dangerously close to far exceeding that amount.
10-28-2009 10:21 AM
Darin.K wrote:
Although, my goal is to learn one new thing each day, I am getting dangerously close to far exceeding that amount.
Then you better stop and tell your boss you need to go home for the day.