04-30-2009 05:14 AM
Hi
I want to send some data using the Write to Spreadsheet VI, which i've managed to do. now i want to give each column a heading: 'DC1', 'DC2', 'q' and 'Re' in my case. i have attached my prog (its a bit messy and prob inefficient...)
before the headings i want some information that is manually inputted (see my prog) i.e 'Wing Type', 'Angle of Attack' and 'Sweep'. again i want a heading for these and their corresponding values. but i only want this information to appear once in the file right at the top and not everytime i run the the VI, which is what i will be doing and appending data as i go along - see below.
the nature of the experiment is such that i will run my program whenever the apparatus is ready and the data will be gathered and outputted to the file. the next run will be carried out and the corresponding data will be added to the current file (using the 'append to file' option). however, as it stands the headings keep adding everytime i run but i only want them to appear once at the top (just after the information mentioned in the previous paragraph).
so the outputted file will look something like (comments are on the side indicated by '<---'):
Wing Type: Coupled <--- these 3 lines only need to appear once here
Angle of Attack: 2.3
Sweep: 30
DC1 DC2 q Re <--- only needs to appear once here
1 2 3 4 <--- first line corresponds to running the program once
2 4 6 8 <--- this line outputs the data gathered when the program is run for the second time (only the data is exported)
can anyone help? thanks in advance.
04-30-2009 06:04 AM - edited 04-30-2009 06:05 AM
Hi aa2105,
you can check if your file already exists. If it exists you don't write the header again, if not then you do. You should use an error cluster (or the duplicate path output of the first function) to specifiy the dataflow. In your vi it's not really sure which "Write to Spreadsheet..." function will be called first.
Mike
04-30-2009 06:49 AM
Even if NI try to hide the fact that Labview is a programming tool with the EXpress VI concept. Labview is still a programming tool. Here is what you do and it is also your first lesson in the sub VI concept. Double click on one of the "Write To Spreadsheet File VI " this will open the front panel. Open the block diagram. And do the modifications I have showed you in the picture. Then you are done save the new VI. But use the "save as" option under File in toolbar. If not you will lose the original VI. Also do not save it under the vi.lib folder. Select a another folder. If you know how try to change the icon also. Give it a personal touch. Now you have your own Vi for writing the header. You can write in header as plain text. Then you want a delimiter you write a "," in the text. I guess this could be done in a more fancy way but you are a beginner so small steps are needed. Then you get some more experience try to avoid the Express VI concept. The hole concept works against its intention and is only contributing to poorer programming skills.
1)Then starting a new Labview session enable context help (Ctrl+h). Do not be afraid to use the detailed help option
2)Then stuck, go to help in the toolbar then select find examples