From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
09-26-2013 05:52 AM
I have a problem.
I have a random number generator, it goes from 0 to 20, I need to have two indicators, one will show how many numbers are pairs, and how many are not.
I tried to use the decimated 1D array, but since those numbers are random, it doesn´t work for me. I´m new with LabView, and I don´t know if there is some other way to make it work, I need some help, especially with some examples.
Thank you so much.
Solved! Go to Solution.
09-26-2013 07:12 AM
Hi,
Your thread title says "Even and Odd numbers", but your description of the problem states 'pairs'.
Can you clarify exactly what you are trying to do.
Thanks
09-26-2013 07:19 AM
What do you mean by "pairs"? Just that a number is duplicated or that you have two of the same number back to back?
09-26-2013 11:48 AM
Hi.
I need to indicate how many numbers are even and how many are odd
Thanks.
09-26-2013 11:49 AM
I need to indicate how many numbers are even and how many are odd
Thanks.
09-26-2013 11:54 AM
I don't think your issue is necessarily with LabVIEW, although your unfamiliarity with it might distract you from what you really need to do. Have you thought up of how you would do it on paper yet? Maybe base your sorting on whether or not dividing by two leaves a remainder?
09-26-2013 11:55 AM - edited 09-26-2013 11:55 AM
Create the array. Use quotient remainder to divide by 2. Now you have an array where all the odd numbers are now 1, and all the even numbers are now 0. Sum the array and you have the total number of odd numbers. The number of evens will be the length of the array divided by the # of odds.
09-26-2013 12:00 PM
@RavensFan wrote:
SpoilerCreate the array. Use quotient remainder to divide by 2. Now you have an array where all the odd numbers are now 1, and all the even numbers are now 0. Sum the array and you have the total number of odd numbers. The number of evens will be the length of the array divided by the # of odds.
Haha I lost sight of the fact that he was looking for the amount off odds and evens. Good one.
09-26-2013 12:12 PM
09-26-2013 12:17 PM
@RavensFan wrote:
SpoilerCreate the array. Use quotient remainder to divide by 2. Now you have an array where all the odd numbers are now 1, and all the even numbers are now 0. Sum the array and you have the total number of odd numbers. The number of evens will be the length of the array divided by the # of odds.
"The number of evens will be the length of the array divided by the # of odds."......you mean subtracted not divided?