The Daily CLAD

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

Re: In Range and Coerce

SercoSteveB
Active Participant

What is the value in Numeric Value Out following execution of the VI?

Cooerce.png

a) 0

b) 7

c) 11

d) 54

NOTE: Please read the comments associated with this post.  The 'In Range and Coerce' node has 'Compare Aggregates' and 'Compare Elements' modes which impact this question.  Nice spot NielHayes

Comments
StefanoFacchine
Member

Hi,

concerning the for loop, the structure executes 3 times. The output value of the N-indicator is 3 for all iterations, so at the end the output of the for loop is ((2x3)x3)x3=54. The following node (in range and coerce) coerces the output value to 11, since the input value of 54 exceeds the uppre limit that is 11. So the correct answer should be c).

faymia
Member

I agree the answer is C.

YogeshShivarudrappa
Member

Hi All,

I got with the ans C.

saki
Member

Yes even i go with ans C.

ManjuG
Member

Hi all,

    here the for loop will iterates 3 times so (((3*2)*3)*3) = 54, then 54 is greater the upper limit so the ANS is c) 11.

mini09
Active Participant

Friends accept with all those who go with C

Ajay_MV
Active Participant

C. 11 is the answer.

--
Ajay MV


Musab Siddiq
Member

Thanks to Steve & BenoitP's comments in the Daily CLAD, they were quite helpful with practise on the worked out examples in the LabVIEW. I passed my CLAD exam today.

mini09
Active Participant

cong Muzab....

SercoSteveB
Active Participant

Nice one Muzab, congrats

SercoSteveB
Active Participant

Answer: C.  Nice one everybody that answered.  This one was popular.

Hi Stefano good explanation (as usual)

SKant
Member

Ans c

manolito
Member

no idea at all. the last value for N will be 3, the left shift register has a 2 always then 2X3 = 6. Why did you multiply by 3^2?

Thank you

crossrulz
Knight of NI

N is always 3 because N is the number of iterations of the FOR loop.  The shift register keeps the value from the previous iteration.  In this case, the shift register is initialized with 2.  So for the first iteration you get 2*3, which is 6.  The next iteration you get 6*3, which is 18.  The third (and final) iteration you get 18*3 which is 54.  However, the result of the shift register is then going into an In Range and Coerce function.  This function limits the range that the output can be.  Since you have a range of 7 to 11, the output of the function will be 11.  So the answer is C.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
canonboy
Member

Sorry to come late to the party, I've been reading a lot of these blog posts to help prepare me for the CLAD and have really been learning a lot.  I'm curious though about this question, I had never seen the "in range and coerce" function, so I decided to play with it some and noticed that there is an option to compare elements or compare aggregates.  Correct me if I'm wrong, but there isn't any notifier in the icon that shows if it's comparring with the intent to coerce or not (depending on what compare funciton is selected), so technically, this question doesn't have enough info to really determine if the answer is 54 or 11. Thoughts?

crossrulz
Knight of NI

NielHayes wrote:

and noticed that there is an option to compare elements or compare aggregates.  Correct me if I'm wrong, but there isn't any notifier in the icon that shows if it's comparring with the intent to coerce or not (depending on what compare funciton is selected), so technically, this question doesn't have enough info to really determine if the answer is 54 or 11. Thoughts?                   

I don't see any arrays or clusters, therefore that setting does not matter.  Even still, the output value can't be outside of 7 and 11.  Therefore 11 is the answer.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
canonboy
Member

Hmmm, my code seems to show that it actually does matter...

Element.jpgAggregate.jpg

SercoSteveB
Active Participant

Hi All,  I would like to know what that setting does though?

canonboy
Member

So from what I understand, the "compare Elements" mode, takes a look at the lower and upper values and coerces them to one or the other if the value is outside the limits and outputs a t/f if it your value is in range of the lower and upper.  The "compare Aggregates" passes the value through regardless of it's within the limits and outputs a t/f if the value is within the range. So even though the function command is defined as "in range and coerce" it should be more like "in range and the option of coersion"... 

crossrulz
Knight of NI

straight from the LV Help:

coerced(x) returns the coerced or unchanged value of x. If x is within the range set by the upper limit and lower limit inputs or if the function is in Compare Aggregates mode, the value is unchanged. If x is not in range and the function is in Compare Elements mode, the function converts the value to the same value as upper limit or lower limit. If upper limit, x, or lower limit is NaN, coerced(x) is NaN.

So bascially, if you set it to Compare Aggregates, only the In Range? comparison is done.  The coerced value is just passed through.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
canonboy
Member

Which makes this daily CLAD needing some more clarification in the setup, or accepting the answers of either 11 or 54, based on a proper explanation.

ashwinilele
Member

C