From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

indicate how many times there is a higher or lower value than indicated

hello everyone, what I'm trying to do is show values above or under a value that I choose ​​of a continuous signal that varies from 10 to -10 .From these            I would like to show only values ​​above or under a value of my choosing. For example that values ​​only them look (above / under) of +5, to -5. (Thing that I already have resolved, maybe not the best). -> And to  indicate how many times there is a higher or lower value than these.

I attached my .vi that I have. If anyone can help me because I have trouble doing this.

 


 

0 Kudos
Message 1 of 7
(2,759 Views)

Some comments:

 

  1. Why are converting DBL to DBL (twice)?
  2. The comparisons belong inside the case structure. Don't use partially unwired tunnels. Zero is a real value! What if you would generate numbers between 20 and 50, suddenly the min would be the impossible zero.
  3. Use min&max instead of "compare and select", less code.
  4. Initialize the max with -inf and the min with +inf (see point 2).
  5. You don't need the "value" indicator. Simply show the digital display of the chart.
  6. Don't use a button for switch action booleans
  7. ....

See attached modification (LV2012)for some ideas.

Message 2 of 7
(2,742 Views)

I could not open your vi ( have 2009 )

But see if you want this.

I think you are getting data from some sensor replace input value with that.

0 Kudos
Message 3 of 7
(2,740 Views)

And here's how to count how often he value is above or below a certain limit.

 

 

Message 4 of 7
(2,732 Views)

I really appreciate that you take a time to solve my trouble

and I'd like to know if there are any problem to choose" use default if unwired" because when I run my original code, this works good (apart of the explanation in point 2)
I probed with the function max & min ,too with the same structure and I choose "use default if unwired" and I attached the other vi because I think the solution to my question can be useful to both and yeah the function max&min is less code


 

now I try to detect a peak could you check my code. I have problem to represent the peak on the graph

0 Kudos
Message 5 of 7
(2,683 Views)

and if other take the time to help with this. Your responses will be well received ,too Smiley Happy

0 Kudos
Message 6 of 7
(2,675 Views)

Hey there;

 

So if you chose to use default if unwired in the cases where the button read is not pressed you will get the default value (cero) I believe that is the expected behavior in you program;; or you might also want to wire a NaN constant instead.

 

You could use the InRangeAndCoerce VI; this VI will tell you if a signal's value is between two desired limits and will give you a TRUE boolean in case they are not. 

 

By the way; i you will be using a DAQ Assistant instead of your "Random Number" make sure you configure it to 1 sample software timed.

 

Hope this helps

 

Cheers

0 Kudos
Message 7 of 7
(2,621 Views)