LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Replace a value to last occurring value

Solved!
Go to solution

Hi all.

 

I'am a relatively new LabVIEW'er and I have a problem which maybe for some people is easy to solve. 

I need to replace a value in a array that when it exceeds a given threshold it replace the exceeded value with the last not-exceeded occurring value. Do it make sense?

 

I trying to incorporate a Case Structure and so far I've think I got it right with the TRUE situaiton but I need some help with the FALSE situation. 

 

Thanks!

0 Kudos
Message 1 of 11
(3,218 Views)

And here is my VI so far.

0 Kudos
Message 2 of 11
(3,216 Views)

Hi clausny,

 

in the FALSE case you shouldn't replace anything Smiley Wink

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 11
(3,215 Views)

Hi clausny,

 

now based on your VI:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 11
(3,212 Views)

Hi. Thanks for reply.

 

Could you post me a labview version of your solution. I think I would be able to understand it better then.

 

 - Clausny

0 Kudos
Message 5 of 11
(3,210 Views)

Hi Clausny,

 

both solutions presented are snippets...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 11
(3,208 Views)

Sorry, but when I drag it to my VI I got nothing. I am using a windows computer.

 

 

0 Kudos
Message 7 of 11
(3,203 Views)

Hi Clausny,

 

as has been written before (it's a FireFox problem):

Drag the snippet onto your desktop, then drag it into your block diagram...

 

Ever tried the search function here in the forum?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 11
(3,201 Views)

Thanks, that helped!

 

Fine solution but beside that I now do not need loops, is there any functional differents? Maybe there is and I just can't see it. My point is that I want the exceeded value to be replaced by the last occerring not-exceeded value. 

 

I do not know have exactly this "Select" vi works. Does the false case take the last not-exceeded value and replace the exceeded value?

 

Sorry for my stupidity Smiley Happy 

 

0 Kudos
Message 9 of 11
(3,190 Views)

Hi Clausny,

 

the help for Select says:

"Returns the value wired to the t input or f input, depending on the value of s. If s is TRUE, this function returns the value wired to t. If s is FALSE, this function returns the value wired to f."

 

The last "good" value is stored in the shift register.

Replacing is done by using autoindexing at both input and output in the 2nd example, the 1st one uses an Inplace structure.

 

"beside that I now do not need loops"

??? Both examples use a FOR loop...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 11
(3,187 Views)