03-06-2014 03:54 PM
just mod 2 each integer. Use the remainder as your answer. Then convert to Boolean
03-06-2014 03:57 PM
Research the "String To Byte Array" function.
Also Auto indexing For Loop.
Also think about the fact that ASCII Codes 48 50 52 54 56 for the string char '0','2','4','6','8' are even
and the ASCII Codes 49 51 53 55 57 for the string char '1','3','5','7','9' are odd.
You could use "Quotient & Remainder" but if you understand binary representation of numbers, the bit shift function "Rotate Right With Carry" and the Not function would be another opptions.
Post back what you have come up with.
03-06-2014 03:58 PM
Well, you could convert it to a byte array and immedately convert it to a single-character array to be processed. 😄
The nice thing about ASCII representation of numbers is that even/odd matches between value and code. 😉
03-06-2014 04:19 PM
Along altenbach's line of thought, i can get it using 4 primitives and no for loop. I too have a hard time thinking in terms of bits but exercises like this help.
03-06-2014 04:28 PM - edited 03-06-2014 04:30 PM
This is the LabVIEW's version of "I Can Name That Tune in 3 notes".
I can code that in 4 nodes
I too go with altenbach's solution
A bitwise AND with a special number is typically simpler. Try to figure it out.
"String To Byte Array" function
"And" function
"Equal to 0?" function
and a U8 constant
Boolean array indicator
03-06-2014 04:36 PM
@Omar_II wrote:
This is the LabVIEW's version of "I Can Name That Tune in 3 notes".
I can code that in 4 nodes
I too go with altenbach's solution
A bitwise AND with a special number is typically simpler. Try to figure it out.
"String To Byte Array" function
"And" function
"Equal to 0?" function
and a U8 constant
Boolean array indicator
You could have at least mixed up the order of the nodes so as not to give it away. Also, as a beginner Labview programmer, the OP should probably not turn in this method as the solution....may look suspicious to professor.
03-06-2014 04:39 PM
aputman wrote:
Also, as a beginner Labview programmer, the OP should probably not turn in this method as the solution....may look suspicious to professor.
As a professor I would ask about each step and how they figured out that those set of steps produced the right outcome. If they could tell me how they did it I would start asking much harder questions.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
03-06-2014 05:52 PM
Ok, I figured it out. I converted the string to an unsigned byte, which I then auto-indexed into a for loop. I then used the quotient and remainder function and modded each element by 2. I then used a case structure. I set 1 as the default, which output false, and had 0 output true. I then auto-indexed this out of the loop and put a boolean indicator. P.S. This was only a small part of a bigger assignment. Part of the problem was that another part of my code was messing everything up. Thank you so much for the help!
03-06-2014 05:59 PM - edited 03-06-2014 06:08 PM
@vikingsfan345 wrote:
Ok, I figured it out
. I converted the string to an unsigned byte, which I then auto-indexed into a for loop. I then used the quotient and remainder function and modded each element by 2. I then used a case structure. I set 1 as the default, which output false, and had 0 output true. I then auto-indexed this out of the loop and put a boolean indicator. P.S. This was only a small part of a bigger assignment. Part of the problem was that another part of my code was messing everything up. Thank you so much for the help!
That sounds way too complicated 😄
Try to simplify it! (e.g. replace the case structure with an "=0", then "right-click...remove" the FOR loop. :D)
03-06-2014 06:15 PM
@altenbach wrote:
@vikingsfan345 wrote:
Ok, I figured it out
. I converted the string to an unsigned byte, which I then auto-indexed into a for loop. I then used the quotient and remainder function and modded each element by 2. I then used a case structure. I set 1 as the default, which output false, and had 0 output true. I then auto-indexed this out of the loop and put a boolean indicator. P.S. This was only a small part of a bigger assignment. Part of the problem was that another part of my code was messing everything up. Thank you so much for the help!
That sounds way too complicated 😄
Try to simplify it! (e.g. replace the case structure with an "=0", then "right-click...remove" the FOR loop. :D)
Ok, that makes sense. Thanks.