I have a question regarding writing to file. Currently in my program, when I start running it, a dialog box pops up and the user gets to pick/ create a file. My data is written on to a file as columns. I want to add column names to the file. Any suggestions on how to do it? Since the file is created by the user at run time and since the column names have to be added just once at the beginning, I'm not sure how to go about doing this. Any suggestions or pointers?
I guess it depends on what kind of file you are writing. For instance, if you need to write a 2D array of numbers to a text file (ie, CSV file equivalent of Array to Spreadsheet File.vi):
If you need to write the data as you go, your can either pile it up in memory as you go and then do the procedure above, or you can write it out to the file and then open the file and pre-pend the column headers as described above and the replace the file contents.
I know, seems messy. I agree. Does this help?
i wanted to ask you help. i saw your program bt i am having a big problem
here is my VI. i actually have to do a database where there is the name of the student,
date of equipment of borrowal. time of the equiment when it was borrowed and its date
but when am doing this. each time i always have to create a new file each time.
i cant use the only onw file.:(
and also my 2nd problem is that when the output is being yielded, it is repeatedly
givine me the same output twice, thrice and a lot like in the pic below
Can you please attach your code to this forum? Instead of just an image. I would like to recreate your issue myself.
I do notice that you are not specifying a file path in your first Open/Create/Replace File function, if you do this, then this should solve your first problem of LabVIEW creating a new file each time.
Are you using excel? In order to append the data to the end of a file in excel, you can look at the document below, which shows you how to do this.
This document is a good starting place, please let me know if you have any questions.
thank you very much sir.
which version of labview are you using. i will upload accordingly to what you can open.
i am using labview 2013. yeah sir it is excel.
You can open up context help (Ctrl+H) and hover over the icon in question. It will display the name of the icon. Please let me know what is the exact name of the icon, and I will be able to tell you which toolkit to download.