LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

In range and coerce

Solved!
Go to solution

I want to make a VI that will show me how many random numbers from 0-100 range should be generated. After that VI should draw a histogram, showing how many percent of numbers were from 0-49 range and how many from 50-99. There should also be two numeric indicators showing how many numbers were from both of those ranges.

 

I use "In range and coerce", but for example if I generate numbers: 78, 97,74;

 

First "In range and coerce" (50-99)" will show output: 78, 97,74, which is correct.

 

But second "In range and coerce" (0-49)" will show output 49,49,49 which I dont want; I just want to show in this example one zero.

After that I will connect both input to histogram, will be OK ?

 

See picture, thanks

_________________________
Rookie; LV 2011 on WIN 7
0 Kudos
Message 1 of 20
(3,563 Views)

Hi hlod,

 

did you read the context help for InRangeAndCoerce? That would clear up your first qeustion...

 

Did you try the histogram VI without any InRangeAndCoerce? It's all you need...

Best regards,
GerdW


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

If your only goal is to plot an histogram, use the histogram function from the probability & statistics palette :

 

Example_VI_BD.png


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 3 of 20
(3,548 Views)

Wll I must show on histogram "how many percent of numbers were from 0-49 range and how many from 50-99.", so for this reason I'm using "In Range and Coerce Function". But I have problem which I already described.

_________________________
Rookie; LV 2011 on WIN 7
0 Kudos
Message 4 of 20
(3,541 Views)

Hi hlod,

 

read the context help for hsitogram!

 

Then do a simple computation of your percentage values from the given histogram values: percentage = (#numbers in range)/(#all numbers)*100%

Best regards,
GerdW


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

Yes I know that but I have probelms, that from 3 input numbers,"in range and coerce" function make:

 

78, 97,74  and  49,49,49;

 

From 3 input numbers I need 3 output not 6 :/. If it's not in range, why than show 49,49,49 ?

 

 

After that I will make front side as this on picture

 

_________________________
Rookie; LV 2011 on WIN 7
0 Kudos
Message 6 of 20
(3,533 Views)

Hi hlod,

 

did you  read message #2? Then you would have read the context help for that function and in turn you would know, why it outputs 49 for your second case...

 

That's the way "In Range and Coerce" works... Well, this function has a second output. You could use that to count the numbers in the given range... But hey, it is all written in the context help!

 

Did I mention the context help before?

Best regards,
GerdW


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

Yes I read it, but I cannont make VI as on picture 1 post up. (please look it), I need function "in range and cou.."

 

 

_________________________
Rookie; LV 2011 on WIN 7
0 Kudos
Message 8 of 20
(3,526 Views)

Hi hlod,

 

no, you don't need InRangeAndCoerce as was written before!

Best regards,
GerdW


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

I really think you should not use the "in range coerce" primitive...

 

Is this what you're trying to get?

 

Example_VI.png


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 10 of 20
(3,521 Views)