LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert only the first false to true after a series of true values

Solved!
Go to solution

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.

 
Inline image 2
 
I expect this code reserve the last t/f value so it passes true if the current value is the first false after a series of true by OR instruction. But this code do not conserve the last one. Do you have any idea to fix this? Or do you have another way to implement what I want to do? Thanks for your help.
0 Kudos
Message 1 of 13
(3,833 Views)

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.

 

0 Kudos
Message 2 of 13
(3,825 Views)

using first call was my first thought...Smiley Wink

Example_VI.png

0 Kudos
Message 3 of 13
(3,811 Views)

@apok wrote:

using first call was my first thought...Smiley Wink

 



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.

0 Kudos
Message 4 of 13
(3,807 Views)

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!

0 Kudos
Message 5 of 13
(3,805 Views)

@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 Smiley Wink

Message 6 of 13
(3,801 Views)

@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?

0 Kudos
Message 7 of 13
(3,781 Views)

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.

0 Kudos
Message 8 of 13
(3,777 Views)

Here's what I would do.

 

 

Download All
0 Kudos
Message 9 of 13
(3,764 Views)

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.

0 Kudos
Message 10 of 13
(3,748 Views)