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: 

Clear shift register before running VI again

Solved!
Go to solution

I have this very simple VI that read voltage from a DAQ until I stop the loop, it then saves the data into a .wav file.

 

My problem is: everytime I stop the VI, I would expect the shift register to clear. But if I restart the VI it saves the old data from the shift register and the new data into the .wav file. I just want the new data when I run the .VI, without having to close the program everytime.

 

Please help.

0 Kudos
Message 1 of 13
(7,246 Views)

Pop-up on the SR and create a constant.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 13
(7,240 Views)
Hi, I tried doing that with a zero constant, but it causes a bunch of broken wires since the wire type is dynamic, but the constant is not.
0 Kudos
Message 3 of 13
(7,229 Views)

We I'll be... !

 

I never use the dynamic data type so  I can only offer a possible work-around.

 

Cntrl-copy the the Waveform Graph 2.

Right-click and select "Change to Constant"

Wire that newly created constant to the outside of the SR.

 

Does that work?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 13
(7,222 Views)

That allows me to create a constant(a very weird looking one), but it does not clear the shift register.

 

d.png

Message 5 of 13
(7,214 Views)
Solution
Accepted by topic author Gear

right click the array control and choose "clear array" (or whatever tht option os called) and try it again. that is a cluster of an array of waveform data types. You can right-click (afterwards) and choose "view as icon".

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 13
(7,207 Views)
Solution
Accepted by topic author Gear

When you use that method to create a constant, it keeps the data from the control that it originated from.

 

Right click on the edge of the array constant until you see an option that says "Data Operations" > "Empty Array".

 

That should clear it out.

 

EDIT: oops, Ben posted the same thing while I was typing.

Message 7 of 13
(7,205 Views)

You need to initialize the shift register. The best way I've found to do that with dynamic data is to use a conversion to a blank array constant. See the attached screen capture

0 Kudos
Message 8 of 13
(7,199 Views)

Perfect!! But the name was "delete element"! Great idea with the "replace" option!!

0 Kudos
Message 9 of 13
(7,196 Views)

Perfect!! But the name was "delete element"! Thank you

0 Kudos
Message 10 of 13
(7,195 Views)