05-22-2012 02:21 PM
I'm using the MS Office Toolkit to read data from Excel files. See attached vi image. Each time I run this subvi, SERNO is different, directing it to a different file. The data read, however, consistently comes from whatever SERNO was used FIRST. In other words, subsequent runs of this subvi result in the same data being read, even though the filename is different. If I close all vi's and exit Labview and re-enter, it reads data correctly....the FIRST time. Why is this happening?
05-22-2012 02:27 PM - edited 05-22-2012 02:28 PM
The only thing that jumps out at me is the uninitialized shift register which holds your output data. That shift register will hold its data between calls, until the VI is removed from memory. I'm guessing that what might be happening is that your output data array is just getting longer...and longer...and longer...The same data isn't being read -- your new data is being appended onto the data read by your previous call to the subVI.
Try initializing that shift register with an empty 2D DBL array and see what happens. If that doesn't fix it, post back.
05-22-2012 02:28 PM
Here's the subvi.
05-22-2012 02:46 PM
Thank you VERY much. That did it. DUH!
05-22-2012 03:07 PM
Spoke too soon. It cures the problem but now the first row of my output array is always 0.
05-22-2012 03:12 PM
05-22-2012 03:52 PM
I think Ben64 is quite right. Just right-click that shift register and select "Create...Constant". That will create an empty 2D DBL array, connected to the shift register.
05-23-2012 03:17 PM
Thank you very much, that did it. I didn't know you could initialize with an empty array.