LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reuse data from the input to a sub vi

Hi,

 

I hope i can explain this well enough,  i have a subvi that has a string input, it reads the string and processes it. this subvi gets called quite a few times.  each time with a different input, now i need to  call it/run it and have it remember the previous input and merge it with a new input.  i can deal with that part easy enough with a boolean input so i can switch between the current input or the previous input + new input.  its getting the previous input data i am struggling with, i cant read control because it will read the new input i am sending it.  i hope your still with me! 

can anyone suggest a way to do this?  i guess i could use a global variable, but i always hear people say to stay away from them.

 

Thanks

0 Kudos
Message 1 of 4
(1,472 Views)

Perhaps a feedback node is what you're looking for.

0 Kudos
Message 2 of 4
(1,469 Views)

I, personally, find feedback nodes more complicated than a "Do Once" While Loop with a Shift Register that "remembers" the previous call.  You make it "do once" by wiring a True constant to its Stop terminal.  Here's a picture (I know, I say "Don't post pictures ...", but I wanted to put in a label ...

Last Input.png

I hope this isn't the first time you've seen something like this.  If it is, just try to code it up and run it a few times, putting an indicator on the Shift Register terminal shown as "Last Input".  If you run with Highlight Execution (the little light-bulb) turned on, it should be crystal clear how this works.

 

Bob Schor

0 Kudos
Message 3 of 4
(1,443 Views)

Thanks for your advice, i am fully aware of using the shift register and how you can retrieve the previous data by dragging down the shift register arrow on the riaght hand side.  i cannot use this in the vi i am using.  i have never used a feedback node so i will have a play with that.

thanks

 

0 Kudos
Message 4 of 4
(1,407 Views)