Hello everybody, I'm a fresher, for the wrong answers for the next questions, could anybody explain for me a reason ? Please and thanks so much. I need to understand deeply, not only the true answers.
For starters look up all the functions if you are not familiar with them. Also I recommend dragging the snippets in LabVIEW and then use probes to check what is going on.
The boolean array to number function will transform the array to number. The default representation is U32 and in Daily CLAD you can expect the default unless stated otherwise.
The logical shift will shift the bits of the numbers like Bcortes showed. The lower input is the number to shift and the upper input how far to shift. If the upper input is positive, the bits will move to the left meaning in direction from least significant to most significant bit. If the upper input is negative the direction is reversed. Important note: Bits that are shifted 'outside' will NOT roll over to the other side, instead there will be padding with 0s.
The important nodes are the compound arithmetics which work bitwise: ^ = AND and v = OR.
About the wrong answers:
A) You have "Original number OR Shifted number" meaning that TRUE bits of the original number will always be set plus the bit of the shifted number. And U32 representation means there is no danger that the shifting will turn the number negative. This means in all iterations the "Greater than 0" function will output true and the output array of the FOR-loop will not be identical to the original.
B) The "Shifted number OR 1" will guarantee that at least the least signifant bit will always be set plus the TRUE bits of the shifted number. This leads again to the output array of the FOR-loop being all TRUE and not identical to original.
D) A bit more complex. Here you have bitwise AND of the shifted and the orignal number. In first iteration the shift by 0 and orignal are identical -> Output 101001 -> Greater than 0 -> TRUE.
Second iteration the shifted number is of by 1 bit. 1010010 AND 0101001 = 0000000 -> Not greater than 0 -> False. If you go through all iteration the output of the FOR loop will be T, F, T, T, F, T. This will again be not identical to the orignal and the Boolean Array Out will be T,T,T, F, T, T and not all TRUE.
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
Check out the Logical Shift LabVIEW 2017 Help. In summary, the lower input terminal (x) value is shifted to the left the number of bits defined by the value of the upper input terminal (y). output = x << y. It is a good idea to think about your values in binary representation when dealing with Logical Shift.
NOTE: You can shift to the right by specifying a y value of less than 0.