LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Excel file problem- new path/file but same data

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?

0 Kudos
Message 1 of 8
(2,653 Views)

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.

Message 2 of 8
(2,650 Views)

Here's the subvi.

0 Kudos
Message 3 of 8
(2,646 Views)

Thank you VERY much. That did it. DUH!

0 Kudos
Message 4 of 8
(2,635 Views)

Spoke too soon. It cures the problem but now the first row of my output array is always 0.

0 Kudos
Message 5 of 8
(2,627 Views)

I don't have LV2011 so I can't open your vi but my guess is that you initialized the shift register with an array of 0 instead of an empty array.

 

Ben64

Message 6 of 8
(2,623 Views)

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.

0 Kudos
Message 7 of 8
(2,614 Views)

Thank you very much, that did it. I didn't know you could initialize with an empty array.

0 Kudos
Message 8 of 8
(2,585 Views)