03-07-2016 04:10 PM - edited 03-07-2016 04:13 PM
@James.M wrote:I'm still not sure why this solved his problem because he didn't share the code itself... but this is an interesting way for the code to wait a few iterations before accepting a True boolean. My guess is there's something else in the code that needs a few iterations to fully initialize.
Since it's essentially summing the integers it could also be replaced by (i*(i+1))/2 in what ever way hey wanted to do that, which would remove the dependency on the feedback node.
Going even further, he could just work out that on iteration 15 (i=14) the comparison would go true (output of additon being 105), and wire the iteration counter straight into the comparison and change it to 14.
edit: Ahhh. Having actually read the thread now, I see it's actually been mentioned. Oopsie.
03-08-2016 01:12 PM
@Hornless.Rhino wrote:
@James.M wrote:I'm still not sure why this solved his problem because he didn't share the code itself... but this is an interesting way for the code to wait a few iterations before accepting a True boolean. My guess is there's something else in the code that needs a few iterations to fully initialize.
Since it's essentially summing the integers it could also be replaced by (i*(i+1))/2 in what ever way hey wanted to do that, which would remove the dependency on the feedback node.
Going even further, he could just work out that on iteration 15 (i=14) the comparison would go true (output of additon being 105), and wire the iteration counter straight into the comparison and change it to 14.
edit: Ahhh. Having actually read the thread now, I see it's actually been mentioned. Oopsie.
Yea, the FBN and Pt-by-Pt function (along with all the convoluted logic) have a simpler implementation with Min/ Max and a SR that is properly initialized. ON THE PLUS SIDE! Pavel seems to be working hard and learning!- Jump on in.
03-21-2016 03:23 PM - edited 03-21-2016 03:55 PM
Operating a simple 2 state (T/F) LED the hard way as seen here.
So we have four simple LEDs on the front panel that shold be red or green based on a boolean scalar.
The natural and easy way (right):
For each of the LEDs, make one state (T) green and the other (F) red and wire the booleans to the indicator terrminals.
The Rube Goldberg way (left):
I guess you have to see it to believe it, so here's a picture (I have moved the terminals slightly to keep the image smaller)..
(And yes, even the calling VI has two LEDs that are "operated" in exactly the same fashion. That's like operating a traffic light by sending a painter up the pole every 30 seconds to change the colors. :D)
03-22-2016 05:23 PM
Good question, Christian: Why not?
<sarcasm>
LabVIEW is a graphical programming environment, so adding some additional elements to the BD is an act of increasing its beauty.
And think of her/his boss: If this is the usual coding style there might be enough occasions to slay bugs. The boss can be happy to have employees that are capable in fixing these bugs quickly.
</sarcasm>
Lean and clean code is out. Long live RG.
Note: I have recently been passed a project that comes with a good amount of RG ;(
03-24-2016 02:30 PM
This is a little complex way to create an array results.
Seen here: https://decibel.ni.com/content/docs/DOC-47313
"I won't be wronged. I won't be insulted. I won't be laid a-hand on. I don't do these things to other people, and I require the same from them." John Bernard Books
03-24-2016 03:00 PM
Hi Bsvare! Thanks for the correction! Sometimes when I stare at LabVIEW code all day I get a little woozy and the simple solutions slip under my nose. Brilliant solution.
03-24-2016 03:47 PM
Is it a Rube Goldberg when you spell a word with all the wrong letters?
"Collum" ? I guess that actually means "column".
03-25-2016 09:28 AM
@RavensFan wrote:Is it a Rube Goldberg when you spell a word with all the wrong letters?
"Collum" ? I guess that actually means "column".
Depends on if you have a sudden urge to touch your code and mutter "My precious", or "Filthy local variables"
03-30-2016 12:29 PM - edited 03-30-2016 12:30 PM
You want to get the last value out of the loop? Enqueue it to a queue just waiting for the single element.
Checking to see if the first two elements of an array are what you want? Search the array for the two elements and make sure they are at indices 0 and 1.
Original code:
Simplified Code:
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
03-31-2016 03:49 PM
I just ran in to this gem while going through someone else's source code... I actually had to drop probes before I realized what he was doing with all of the multiplication.