08-11-2010 03:21 PM
In the attached Vi, I have 8 buttons. When one or more buttons are pressed to the "On" case, the boolean returns true else it returns false. I want a unique random number to be generated for each button when the boolean is true.
08-11-2010 03:27 PM
08-11-2010 03:31 PM
@ADrexelDragon wrote:
In the attached Vi, I have 8 buttons. When one or more buttons are pressed to the "On" case, the boolean returns true else it returns false. I want a unique random number to be generated for each button when the boolean is true.
It is not clear what you want:
What boolean? (There are many booleans, but none named "boolean" that I could find)
A random number is unique most of the time, so what does your sentence mean?
What is the program supposed to do?
08-11-2010 04:00 PM
I added the converted vis. I will try to clear things up. I want each button hooked to a separate random number generator. The generation of random numbers should only occur when the button is in the "On" case. The "On" case is signaled by a true boolean.
08-11-2010 04:29 PM
In the False case and in the Search Button Cases, you have another case structure there. If the boolean text is "Off" you assign "On" to the button state, and if the text is "On" you assign "Idle". So in which case do you want to cause a random number to be generated? When button is on or when button text is "On"?
Simply put a random number generator function inside the case where you want it to generate. Wire it out of the For Loop and you will have an array of random numbers with the first element belonging to the first button, and so on..
08-11-2010 06:06 PM
I added what you have said but still do not understand how this works. I have a bunch of zeros that are not needed. The graphs of these are not suitable. If there was a way to only insert the random numbers into the array not the zeros I could graph it.
08-11-2010 06:12 PM
Try inserting NaN in the cases where the random number is not used. These don't show up on a graph.
08-11-2010 06:23 PM
Is there a way to reset a single column because when the button is pressed the third time, I want it to reset the number generation. For example, if elapsed time is being recorded during the time random numbers are being generated, I want these values to be written to an excel file.
08-11-2010 07:32 PM
Here is what I have so far.
08-12-2010 02:03 PM
If by "reset a single column" you mean to clear its contents, then no you can't. All coumns in an array must contain the same number of rows.
From what you are saying, I think your architecture is probably wrong. Try to explain to me exactly what it is you are wanting to do. List the steps and the conditions for any actions.
Why do you want a continuous random number generation and timestamp generation when the button is on? And what defines the button as being on? Is it the boolean text?
For the timestamp, shoudn't you capture only the time that the button turns to on, rather than a continuous flow of timestamps?