LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

if greater than, set equal to zero

Solved!
Go to solution

Hi! I am trying to write a basic if statement at the very end of my VI (the far right side, outside the while loop).

 

I would like any numbers greater than 2.59 X10^6 to be written to the spreadsheet as zero. Any numbers less than that threshold, should be written as they are computed.

 

It seems like a very basic concept but I am running into problems with having the wrong form of data...? As well as getting the output of zero to write to the spreadsheet if it is, in fact greater than 2.59X10^6.

 

Thanks for your help!

0 Kudos
Message 1 of 7
(5,277 Views)
Solution
Accepted by topic author blizabeth37

Hi,

 

You mixed up the data types. Boolean and double.. I attached a simple VI that seems to solve your problem.

 

/ Patrik

Message 2 of 7
(5,267 Views)

Not too bad,  You laked a bit of data-dependance for initialization see the structure on the left.

 

A case statement wasn't needed as you had an array of booleans I simply autoindexed with a for loop and added the select primitive.

 

Enjoy


"Should be" isn't "Is" -Jay
Message 3 of 7
(5,254 Views)

thanks so much!

 

I'm still struggling with how to hook it up to my current arrangement....???

 

How do I hook this up to still write to the spread sheet?

0 Kudos
Message 4 of 7
(5,252 Views)

Thanks everyone for your help! I actually just figured out how to correct the wiring correctly!

 

I really appreciate it!

0 Kudos
Message 5 of 7
(5,246 Views)
Put the new bit of code inside the for loop between the subtraction of the timestamps, and the auto-indexing tunnel.
0 Kudos
Message 6 of 7
(5,243 Views)

You have a control, X, wired to the Greater Than input.  You cannot wire the output of the loop to the same wire.  Can't have two inputs on the same wire.  Delete the wire from X to Greater Than.  Then wire the loop output array to the Greater Than.  Now that will make the output of Greater Than a boolean array.  You can't wire that to the T/F Select function.  So you have to either use And Array Elements or Or Array Elements (found in boolean palette) depending on what you are trying to do.  The output of And/Or Array Elements will be a boolean that you can wire to the Select function.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 7 of 7
(5,224 Views)