# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Verify interval of 3 elements in while-loop

Hello community,

The LabVIEW-Code should compare a 1D Array in intervals of 3 elements with a constant. If all elements in the interval

is less than the constant "2", then the while loop should stop verification.

I would appreciate any kind of suggestion and contributions.

Message 1 of 8
(976 Views)

## Re: Verify interval of 3 elements in while-loop

• Why do you create a 2D array if you want to check a 1D array? I don't think you need the FOR loop at all.
• Why do you compare that same 2D array with a 2D array containing a single element. The comparison should be with a scalar constant instead.
• What is the meaning of "stop verification"? Stop the loop? Continue the loop but no longer check?
• What is the meaning of the control labeled "s"?
• What should happen if you run out of elements and no match has been made?
• Your shift register and 2D boolean array makes no sense.
• Why is the front panel and diagram maximized to the screen? Very annoying!

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 2 of 8
(949 Views)

## Re: Verify interval of 3 elements in while-loop

It is really not clear what you want, but here is some simple code that looks at the array and checks if there is a sequence of 3 elements that are all <2, and returns the first occurrence. While this is probably not the solution, it might give you some ideas....

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 3 of 8
(937 Views)
Solution
Accepted by topic author MarcLee

## Re: Verify interval of 3 elements in while-loop

@altenbach wrote:  I don't think you need the FOR loop at all.

Sure you do.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 8
(927 Views)

## Re: Verify interval of 3 elements in while-loop

Thats exactly what I'm searching for! Thanky you very much.

Message 5 of 8
(923 Views)

## Re: Verify interval of 3 elements in while-loop

@crossrulz wrote:

@altenbach wrote:  I don't think you need the FOR loop at all.

Sure you do.

I was under the impression that his FOR loop was for data prep and that the checking would be happening in his while loop. So, yes, one of the two loops is not needed. Still, the code was so broken that it was hard to tell what the intention of the various elements really was. 😄

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 6 of 8
(922 Views)

## Re: Verify interval of 3 elements in while-loop

While Tim's code is simpler, my code is more flexible because I assumed that you'll ultimately receive data in the loop forever, one point at a time, then continue once the condition is met. Just change to a while loop and read your AI or whatever inside the loop.

Here's how that could look like. This loop will stop after three successive random numbers [0..10] are all <2.

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 7 of 8
(917 Views)

## Re: Verify interval of 3 elements in while-loop

@altenbach wrote:

@crossrulz wrote:

@altenbach wrote:  I don't think you need the FOR loop at all.

Sure you do.

I was under the impression that his FOR loop was for data prep and that the checking would be happening in his while loop. So, yes, one of the two loops is not needed. Still, the code was so broken that it was hard to tell what the intention of the various elements really was. 😄

I knew what you were saying.  I was just trying to be a smart aleck.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 8
(916 Views)