From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

why my array data is duplicated using shift register even if vi is closed?

Solved!
Go to solution

Hello,

I am using LabVIEW 2014 with a student license. The problem that I want to solve is how to retrieve signal data generated from an instrument (date stamp, temperature, humidity and pressure) that is already stored in a TDMS file; my vi is able to search in the TDMS file based in a date range requested by user and then passing that information to an array built in a for loop, display requested data in 3 XY graphs and finally export that information into an excel spreadsheet.

However, I found that if you run the application once it works fine, but if you don’t close the project and run the vi again the data is duplicated several times in my array resulting in a excel spreadsheet with unnecessary information (duplicated) and confusing charts.

Please help me understand whys this is happening and how I can solve this. I already try to replace shift registers with index tunnels but my XY graphs functions are not accepting the data format.

Thanks and regards

 

Download All
0 Kudos
Message 1 of 6
(2,699 Views)
Solution
Accepted by 8bitpeople

Without openning your VI I will tell you that it is because your shift registers are uninitialized (no input to the left hand SR).  In this case they retain values from the previous run unless your VI is recompiled.  What you want instead is to right click the left hand SR and select 'Create Constant' so they start with empty arrays.

0 Kudos
Message 2 of 6
(2,689 Views)

Thank you so much Darin.K, applying the constants solved the problem.

Thanks again

 

0 Kudos
Message 3 of 6
(2,677 Views)
Solution
Accepted by 8bitpeople

You have LabVIEW 2014, so you have the new tunnels!

 

Delete the shift registers and "insert into array" nodes and wire the 1D array directly to the right loop boundary. Now right-click the tunnel and set the tunnel mode to "Concatenating" (see picture). repeat for all outputs.

 

 

 

The code will be much cleaner than with all these shift registers!

0 Kudos
Message 4 of 6
(2,675 Views)

Great, this works also.

Thanks altenbach for the good practice advise.

 

0 Kudos
Message 5 of 6
(2,653 Views)

Here's how it could look like.....

 

 

0 Kudos
Message 6 of 6
(2,649 Views)