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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

conditional statement

hello experts!

hi guys im a very new labview user and theres still a lot i dont understand. i have this code.png. i pretty much know what it does overall but theres this part in it that i dont get code2.png. the numeric on the lower left is the i in the while loop. i hope someone could explain it to me . thanks a lot in advance guys! 😄

Download All
0 Kudos
Message 1 of 5
(3,339 Views)

It looks like you are looping between 0, 1, and 2 until you have a match.  This code looks like a good candidate for a Rube Goldberg.  See if this makes things any more clear.


GCentral
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
0 Kudos
Message 2 of 5
(3,318 Views)

The node immediately after the Numeric is an Remainder/Quotient operator. So it's calculating the remainder of the Index when divided by 3.

The next node is a Selector, which outputs the top input if True and the bottom input if False. In your case, the Selector will be True when Number of Matches is greater or equal to 1 (Yes = True).

The next node is a Feedback node, which is really just adding a single iteration delay to all the values.

 

This code is rediculous, so I would suggest you rewrite it. All it's doing is taking the Numeric and depending on that value with relation to "3", outputting the respective path. 0 = path A, 1 = path B, 2 = path C, 3 = Path A, ...

This is then overruled if Number of Matches is greater or equal to 1...

 

Edit: Like crossrulz said, it's rube-goldberg code.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 3 of 5
(3,315 Views)

The node with the arrow on it is called a feedback node. The output of a feedback node can feeds an earlier input (in a dataflow sense). The initial value (given by the const) is zero.

 

The text-language equivalent is something like this:

 

feedback = 0;
for (i=0 ; i<N ; i++) {
x = (nummatch > 1) ? feedback : 0;
feedback = (nummatch > 1) ? x : i mod 3;
}

 

Message 4 of 5
(3,295 Views)

Be sure to run block diagram cleanup on this code.  It is really hard to follow considering the number of wires that are running backwards, and wires that are running on top of other wires, and wires that have extra loops and bends in them.

 

All of those problems are making it hard follow what is happening with the blue wires which is exactly the section of code you are asking about.

 

Can you explain the comparisons where you are comparing a file path and seeing if that is greater than or equal to a file path consisting of a zero?  I really don't even know what it means to have a file path be greater or less than another file path.  Maybe it is doing alphabetical comparisons of the string values of that file path?

0 Kudos
Message 5 of 5
(3,266 Views)