06-06-2013 11:18 AM
Hi,
I would like to know how I can convert only the first false value to true after a series of true values. For example, I want to make TTTFFF to TTTTFF.
Solved! Go to Solution.
06-06-2013 11:29 AM - edited 06-06-2013 11:36 AM
Your image did not come through. You can't just cut and paste an image from your google mail account. You need to upload the image to the forums using the Insert Image button at the top of the message editor.
I would loop through the booleans (is it a boolean array?) and use the LabVIEW function Boolean Crossing Pt. by Pt. to detect a True to False transition. And if that is true, change the boolean to true.
06-06-2013 11:47 AM
using first call was my first thought...
06-06-2013 11:56 AM
@apok wrote:
using first call was my first thought...
But that ties your code to the event structure. It is not clear from the user's original post that the data is coming in from user interaction of the front panel. Also, first call only works one time. It will not work the the second time there is a transition from True to False.
06-06-2013 12:07 PM - edited 06-06-2013 12:32 PM
Hi,
It seems the boolean crossing is what I've been looking for, but I want to make one thing sure that the T/F sequence is not an array but one per cycle. So the last T/F value in the last cycle should be maintained for the next one. Does this possible with the boolean crossing module?
I attached the Labview file.
Sorry but I've never seen the rounded icon with a dot and tripod which is used for initializer. Where can I found it?
Thank you!
06-06-2013 12:15 PM - edited 06-06-2013 12:17 PM
@RavensFan wrote:
But that ties your code to the event structure. It is not clear from the user's original post that the data is coming in from user interaction of the front panel. Also, first call only works one time. It will not work the the second time there is a transition from True to False.
as most OPs almost never are specific, we get into the game of assumptions and using our crystal balls( does he want this or that, how is the data streamed, does he want to do this on first call or .... )
my post was to give hint, it could of been done with a loop...it does not have to be an event
06-06-2013 12:38 PM - edited 06-06-2013 12:57 PM
@nexuter wrote:
I would like to know how I can convert only the first false value to true after a series of true values. For example, I want to make TTTFFF to TTTTFF.
(1) This seems like a partial specification. Should it reset after receiving another set of trues or not.
For example, if the seuqence is: TTTFFFTTTFFF Do you want: TTTTFFTTTFFF or: TTTTFFTTTTFF?
(2) What should happen if the first element is already FALSE? Should it remain FALSE or turn into TRUE?
If the sequence is FFFF Do you want: TFFF or: FFFF?
06-06-2013 12:43 PM - edited 06-06-2013 12:47 PM
Hi,
(1) I mean the second one. TTTFFFTTTFFF -> TTTTFFTTTTFF
(2) I want to change only the first F after a series of T so if the first element is already False like FFFTTTFFF, then it's going to be FFFTTTTFF.
06-06-2013 12:55 PM - edited 06-06-2013 12:56 PM
06-06-2013 01:07 PM - edited 06-06-2013 01:10 PM
Thanks for your help.
It's a kind of what I want but again in my case, the T/F value I\O is NOT an array. I could get a T/F value at a cycle so that I have to keep the last value in order to compare it with the current T/F value. Sorry that my original question might not be clear but basically I'd like to know how I keep the last value in order to do as you do in a single loop.