10-21-2016 05:26 PM
Hi all
I want my vi to search an existing file and append data to the right of the existing column along with the header. I could write data to different columns but not with the header. The header is written only once and subsequent new data is appended without a header. I've attached my code. Does anyone know how to do this?
Thanks
10-21-2016 05:32 PM
See code screenshot incase for older labview versions
10-21-2016 09:44 PM
@SolPS wrote:Hi all
I want my vi to search an existing file and append data to the right of the existing column along with the header. I could write data to different columns but not with the header. The header is written only once and subsequent new data is appended without a header. I've attached my code. Does anyone know how to do this?
Thanks
If you have the Report Generation Toolkit, this is almost trivial. You can open an existing Worksheet, determine the number of rows and columns present, then start adding new columns to the right of the existing columns, with a header if desired. When the new columns have been added, the Excel file can be saved (with the same or a new name) and Excel closed.
I suppose you could do the same thing with the Delimited Worksheet functions. Read the data as strings (to get sizes). I've not used these functions enough to know if writing Dbl arrays preserve the precision of the original data or not, but you could experiment. Now you need to "expand" the data array by adding another column, then do the appropriate (expanded) Write Delimited Spreadsheet.
It's a little messy, but you might be able to cobble together what you need using one of these methods. Give it a try.
Bob Schor
10-24-2016 11:20 AM
Hi Bob_Schor,
I decided to follow your advice and use excel functions from the report generation toolkit. I've created a VI to do that but I still can't get it work. It still inserts data into the same position deleting the initial data. See attached code and screenshot.
10-24-2016 11:36 AM
Seems like you are over complicating this.
Simply write your column headers as strings to your data file ONCE and BEFORE you enter a loop to write your numerical data.
10-24-2016 11:48 AM
RTSLVU,
I don't understand what you meant by writing the column headers once before entering the loop. The data input to the excel easy table function is a required input and if it's not wired, you'll have a broken VI. Can you explain a bit more or modify the VI I attached?
10-24-2016 12:12 PM
@SolPS wrote:RTSLVU,
I don't understand what you meant by writing the column headers once before entering the loop. The data input to the excel easy table function is a required input and if it's not wired, you'll have a broken VI. Can you explain a bit more or modify the VI I attached?
Okay... Well to start off I don't use the Excel Easy Table, I find it beast to just save my data as a Tab delemited text file, then Excel can read it fine and you can look at it with any text editor.
Bear with me here as this may not be the best example but... Here after I setup my DC source I write my column headers to the data file that the user selects when the dialog pops up.
Then I write my data a row at a time as it's taken.