LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiplying element in array if the value is under a certain threshold

Solved!
Go to solution

Ha Ha.

 

Well, the math itself wouldn't be a hack.

 

But the -1 and +1 to work back and forth to jockey around the 0 and 1 you get out of the boolean to comparison.  It took me a couple minutes to figure how the math was manipulating the gain to get the result.  It starts to feel a little Rube-ish. Smiley Wink

 

I like to be able to look at the code and quickly see what it is doing.

0 Kudos
Message 11 of 16
(933 Views)

@RavensFan wrote:

Ha Ha.

 

Well, the math itself wouldn't be a hack.

 

But the -1 and +1 to work back and forth to jockey around the 0 and 1 you get out of the boolean to comparison.  It took me a couple minutes to figure how the math was manipulating the gain to get the result.  It starts to feel a little Rube-ish. Smiley Wink

 

I like to be able to look at the code and quickly see what it is doing.


Honestly the correct thing to do to make it easier to understand is to replace the increment and decriment functions with add and subtract using the integer array.  But, since the int there is certain to be either 0 or 1....

 

You do the math....:D


"Should be" isn't "Is" -Jay
0 Kudos
Message 12 of 16
(863 Views)

Another way:

 

threshold.png

 

Ben64

0 Kudos
Message 13 of 16
(854 Views)

What impact does the IR&C have compared to GT?

 

I agree that it will work but, did you benchmark the code and find an advantage?


"Should be" isn't "Is" -Jay
0 Kudos
Message 14 of 16
(848 Views)

@JÞB wrote:

What impact does the IR&C have compared to GT?

 

I agree that it will work but, did you benchmark the code and find an advantage?


I take back my earlier agreement.  Toss a NaN in there.

 

And how did you actually scale the inputs by a factor of x?


"Should be" isn't "Is" -Jay
0 Kudos
Message 15 of 16
(846 Views)

Jeff·Þ·Bohrer a écrit :

And how did you actually scale the inputs by a factor of x?

This is the disadvantage here, it is fixed to 2 but in this case this is what the OP wanted.

0 Kudos
Message 16 of 16
(840 Views)