04-03-2008 12:43 PM - edited 04-03-2008 12:48 PM
My program has a case window within a For loop. The loop iteration index is wired to the case, so there’s a case for each iteration of the loop (about 30 cases). In each case, data points are gathered, formatted to a spreadsheet and written to a file, along with some occasional header strings to describe the data. This works fine, as I can simply write the data to file as soon as I get it.
At some point in the loop, I’m gathering from two sources (rpm data for two fans) over several iterations that is to be written to two separate but similar formatted tables in the same output file. Since I’m writing two tables to one file simultaneously, I can no longer write on-the-fly in a linear fashion; I’d need to store all the information until I complete the iterations, then format the header & raw data to spreadsheet and write to file in two chunks – at least, this is what I believe is the way to go, but I’m all ears if there’s another way.
In order to buffer the data, I could use a shift register, but this requires me to wire an array across my loop for all loops, whether I’ll be using it or not. I’ve also considered initializing an array at the case I’ll need to start buffering, then writing to a local variable of that array, but in fiddling with this approach, I don’t see how to specify what index to which I’m storing the data point.
So I’m looking for advice on whether (1) there’s another way to accomplish my goal and/or (2) how to execute the initialize array and local variable approach.
Below is a picture of what I want this portion of the spreadsheet to look like. Also included is a much abbreviated mock-up of my program for a case where I’m writing on the fly for a single table or column of information and a case where I’m setting up the write to local variable approach.
04-03-2008 02:01 PM
04-03-2008 03:39 PM
04-04-2008 08:37 AM
04-04-2008 09:00 AM