Gary Rubin Posted May 8, 2009 Report Share Posted May 8, 2009 Why does the Boolean palette include both a True constant and a False constant? Why does a numeric constant in the BD default to I32, while a control/indicator on the FP defaults to a double? Thank you to whomever changed the Compound Arithmetic so that it defaults to a logical operation when selected from the Boolean palette, and an arithmetic operation when selected from the Numeric palette. Quote Link to comment
Grampa_of_Oliva_n_Eden Posted May 8, 2009 Report Share Posted May 8, 2009 QUOTE (Gary Rubin @ May 7 2009, 01:09 PM) Why does the Boolean palette include both a True constant and a False constant?Why does a numeric constant in the BD default to I32, while a control/indicator on the FP defaults to a double? Thank you to whomever changed the Compound Arithmetic so that it defaults to a logical operation when selected from the Boolean palette, and an arithmetic operation when selected from the Numeric palette. Amen to that! Other subtle changes that I apreciate include; When we wire a error cluster to a case it puts the code in the No Error Case When we create an sub-VI with an error cluster the error in is optional while all other inputs are required. Insert node on a reference wires to the refence input instead of the error cluster... These have all mde my life easier. RE: Why both True and False? I can only guess that in version 1 of LV you could not click on a constant and change it. Re: Philosophical... Before LV will be able to realize true artificial intelegnce, we will need a "Maybe Gate". Ben Quote Link to comment
jdunham Posted May 8, 2009 Report Share Posted May 8, 2009 QUOTE (Gary Rubin @ May 7 2009, 10:09 AM) Why does the Boolean palette include both a True constant and a False constant? I remember changing the constant in front of someone who had used LV for several years, and he exclaimed ,"I never knew you could do that! I always put a NOT function after it." Maybe he wasn't the sharpest tool in the shed, but I'll wager he wasn't alone, so NI put both of them in the palette (in the old days there was only the False constant). QUOTE (neBulus @ May 7 2009, 10:30 AM) When we wire a error cluster to a case it puts the code in the No Error Case When we create an sub-VI with an error cluster the error in is optional while all other inputs are required. Insert node on a reference wires to the refence input instead of the error cluster... I thought these all got fixed from earlier versions when they were much more annoying, but I would agree, the changes were welcome. I wish that when replacing Multiply (for example) with Compound Arithmetic, then the multiply option would automatically be chosen. I also wish that when using Create SubVI... that the Error In and Error Out terminals would be named correctly. I wish there was a simpler Array Size primitive that just resized itself for the number of dimensions. I wish there was a simple PlusAndMinus primitive with two inputs and two outputs. I wish that Merge Errors.vi was a resizable primitive. Quote Link to comment
Gary Rubin Posted May 8, 2009 Author Report Share Posted May 8, 2009 QUOTE (jdunham @ May 7 2009, 02:04 PM) I remember changing the constant in front of someone who had used LV for several years, and he exclaimed ,"I never knew you could do that! I always put a NOT function after it." Maybe he wasn't the sharpest tool in the shed, but I'll wager he wasn't alone, so NI put both of them in the palette (in the old days there was only the False constant). So, originally you could only define a FALSE constant? There was no True? Quote Link to comment
jdunham Posted May 8, 2009 Report Share Posted May 8, 2009 QUOTE (Gary Rubin @ May 7 2009, 11:08 AM) So, originally you could only define a FALSE constant? There was no True? No, you could change it with the Operate tool. But I guess that was non-obvious enough that it was easier to add a TRUE version to the palette than to try to educate people. Quote Link to comment
PaulG. Posted May 8, 2009 Report Share Posted May 8, 2009 When a loop runs ONCE why is the iteration count 0? How can something run once yet still run 0 times? Quote Link to comment
Gary Rubin Posted May 8, 2009 Author Report Share Posted May 8, 2009 QUOTE (jdunham @ May 7 2009, 02:04 PM) <snip> (in the old days there was only the False constant). I see, I misunderstood your comment. You were just referring to what was on the palette... Quote Link to comment
gleichman Posted May 8, 2009 Report Share Posted May 8, 2009 QUOTE (jdunham @ May 7 2009, 01:04 PM) I wish there was a simpler Array Size primitive that just resized itself for the number of dimensions. :thumbup: Quote Link to comment
Aristos Queue Posted May 8, 2009 Report Share Posted May 8, 2009 QUOTE (PaulG. @ May 7 2009, 01:13 PM) When a loop runs ONCE why is the iteration count 0? How can something run once yet still run 0 times? Because the i terminal returns the number of iterations that are completed, and the i terminal returns its value during the current iteration. If you want the iteration count after the loop runs, wire the output of the N terminal, not the i terminal.QUOTE (Gary Rubin @ May 7 2009, 12:09 PM) Why does a numeric constant in the BD default to I32, while a control/indicator on the FP defaults to a double? Because most people want double type for the numeric. But it is really nice on the BD constant to drop it and then, if you need floating point, to type in a value using a decimal point and the constant will automatically change to double type. If it dropped as double by default, if you typed 3, we wouldn't be able to assume that meant you wanted an integer. We'd probably do the same thing on the FP except that most people never type into the thing that drops onto the FP... they just leave the value as zero (and you wouldn't want it coercing to a new type everytime you typed a value into it while you were debugging!). Quote Link to comment
Neville D Posted May 8, 2009 Report Share Posted May 8, 2009 QUOTE (jdunham @ May 7 2009, 11:04 AM) I wish there was a simple PlusAndMinus primitive with two inputs and two outputs. I'm assuming you know about using the compound arithmetic primitive and using "negate" on an input (changing multiply to divide and add to negate)? Its not "simple" but pretty flexible (any number of adds/subtracts in any order).. http://lavag.org/old_files/monthly_05_2009/post-2680-1241723903.jpg' target="_blank"> N. Quote Link to comment
LAVA 1.0 Content Posted May 8, 2009 Report Share Posted May 8, 2009 QUOTE (Gary Rubin @ May 7 2009, 07:09 PM) Why does the Boolean palette include both a True constant and a False constant? Technically it is not a True constant. It is a merge VI containing a True constant. QUOTE (Aristos Queue @ May 7 2009, 09:20 PM) _ If you are a Premium Member you can just delete the post. Ton Quote Link to comment
Mark Balla Posted May 8, 2009 Report Share Posted May 8, 2009 QUOTE (Aristos Queue @ May 7 2009, 02:16 PM) If you want the iteration count after the loop runs, wire the output of the N terminal, not the i terminal.you typed a value into it while you were debugging!). Just to clarify the N terminal outputs the max number of iteration possible. If a conditional terminal it used to stop the for loop it will still output the same number. http://lavag.org/old_files/monthly_05_2009/post-584-1241725090.png' target="_blank"> Quote Link to comment
vugie Posted May 8, 2009 Report Share Posted May 8, 2009 QUOTE (jdunham @ May 7 2009, 08:04 PM) ...in the old days there was only the False constant. It reminded me old russian joke: The beginning of the russian Bible edition: At the beginning there was nothing. Only Comrade God was walking around the streets of Moscow. However it sounds best in russian... QUOTE But it is really nice on the BD constant to drop it and then, if you need floating point, to type in a value using a decimal point and the constant will automatically change to double type. I don't belive! It's the first thing I'll check tomorrow! Quote Link to comment
crossrulz Posted May 8, 2009 Report Share Posted May 8, 2009 QUOTE (Aristos Queue @ May 7 2009, 03:16 PM) But it is really nice on the BD constant to drop it and then, if you need floating point, to type in a value using a decimal point and the constant will automatically change to double type. Tell Darren you found him a nugget for this coming week! This is kind of cool! Quote Link to comment
Aristos Queue Posted May 8, 2009 Report Share Posted May 8, 2009 QUOTE (Ton @ May 7 2009, 02:38 PM) If you are a Premium Member you can just delete the post. I am a premium member, but I'm in the NI group, so I don't get the benefits of membership. I see all the ads too. Quote Link to comment
jdunham Posted May 8, 2009 Report Share Posted May 8, 2009 QUOTE (Neville D @ May 7 2009, 12:19 PM) I'm assuming you know about using the compound arithmetic primitive and using "negate" on an input (changing multiply to divide and add to negate)? Thanks, I knew about that. But what I really want is this... (And I've already suggested it to NI, but you never hear back about that kind of thing). This construction comes up all the time if you use picture controls, or you do GUI arrangements, any kind of 2D coordinate stuff, or histogram bins, or limit testing... I know it sounds like feature bloat, but having a native function for this would lead to much cleaner diagrams. Quote Link to comment
Yair Posted May 9, 2009 Report Share Posted May 9, 2009 As Ton pointed out, the True "constant" is actually a merge VI and it's actually quite new. I think it was only added in version 8.0 or thereabouts. It was probably easier to do it as a merge VI than adding it to the palettes as a primitive. QUOTE (jdunham @ May 7 2009, 11:46 PM) but having a native function for this would lead to much cleaner diagrams. I assume you've already created your own subVI for this? Quote Link to comment
Black Pearl Posted May 9, 2009 Report Share Posted May 9, 2009 I've got both constants in 7.1 For loop: if you wire I to the outside (no indexing), you will get 0 if the loop iterates 0 and 1 times. Not so nice... Felix Quote Link to comment
Cat Posted May 9, 2009 Report Share Posted May 9, 2009 QUOTE (Aristos Queue @ May 7 2009, 03:16 PM) Because most people want double type for the numeric. But it is really nice on the BD constant to drop it and then, if you need floating point, to type in a value using a decimal point and the constant will automatically change to double type. Learning little tidbits like this is why I try to read LAVA faithfully every morning. Thanks! Quote Link to comment
Justin Goeres Posted May 9, 2009 Report Share Posted May 9, 2009 QUOTE (Black Pearl @ May 8 2009, 01:24 AM) I've got both constants in 7.1For loop: if you wire I to the outside (no indexing), you will get 0 if the loop iterates 0 and 1 times. Not so nice... I agree that it's sort of counterintuitive at first, but what would you expect the result to be instead? Even though the For Loop executes zero times, there has to be a data value on the I wire coming out -- that's the nature of dataflow. In this case, what's happening is that wire is taking the default value of its datatype (I32), and that value is 0. Quote Link to comment
asbo Posted May 9, 2009 Report Share Posted May 9, 2009 QUOTE (Justin Goeres @ May 8 2009, 08:40 AM) I agree that it's sort of counterintuitive at first, but what would you expect the result to be instead? Even though the For Loop executes zero times, there has to be a data value on the I wire coming out -- that's the nature of dataflow. In this case, what's happening is that wire is taking the default value of its datatype (I32), and that value is 0. Which is why I often wish LabVIEW had some convention of NULL implemented ... Quote Link to comment
TobyD Posted May 9, 2009 Report Share Posted May 9, 2009 QUOTE (jdunham @ May 7 2009, 01:46 PM) Thanks, I knew about that. But what I really want is this... (And I've already suggested it to NI, but you never hear back about that kind of thing). This construction comes up all the time if you use picture controls, or you do GUI arrangements, any kind of 2D coordinate stuff, or histogram bins, or limit testing... I know it sounds like feature bloat, but having a native function for this would lead to much cleaner diagrams. You could submit this as an OpenG candidate. Quote Link to comment
Black Pearl Posted May 9, 2009 Report Share Posted May 9, 2009 QUOTE (Justin Goeres @ May 8 2009, 02:40 PM) I agree that it's sort of counterintuitive at first, but what would you expect the result to be instead? Even though the For Loop executes zero times, there has to be a data value on the I wire coming out -- that's the nature of dataflow. In this case, what's happening is that wire is taking the default value of its datatype (I32), and that value is 0. Not correct, as the 0 isn't coming out of the I when the loop executes 0 times, the tunnel is giving the default value of 0, which is the same as the I terminal output on first execution. My only 'wish' would be, that executing a loop 0 times would resulat in a different value as executiong it 1 time (be it -1 as default value or start counting at 1). But I'm sure it won't be implemented, as it would certainly break a lot of existing code. To push that point a bit further, I think that for loops of iteration 0 are potential troublemakers. If you don't use a shift register, you might end up with default data instead of the real data (happend once to me with a reference). It is neigther issueing a broken error nor throwing an error 'by wire', and can't be figured out after the loop has executed (actually not executed). Another thing is, that the while loop isn't called 'repeat until' loop. In the text based languages I know, the difference is that the stop condition is evaluated before (unlike in LV) loop execution on a while statement. You can't run into that issue in LV-while loops (repeat until statements). To summarize: you will seldom step on that trap so don't learn it by painful experience and difficutl to debug (and we all fear race conditions, don't we, and that's just because they are difficult to debug, ever had a 'Heisenbug'?). One way to avoid that issue would be to have a required error in/out terminal on the for loops (with shift register behaviour) and an optional terminal 'allowed to execute 0 times'. But that would make such a basic concept a bit too feature-rich for standard users. Felix Quote Link to comment
jdunham Posted May 9, 2009 Report Share Posted May 9, 2009 QUOTE (Yair @ May 8 2009, 12:33 AM) I assume you've already created your own subVI for this? QUOTE (TobyD @ May 8 2009, 07:17 AM) You could submit this as an OpenG candidate. Well the problem is I need it compatible with DBLs, I32s, I16s, Complex DBLs, XY points, and XYZ points, and arrays and clusters of all of those. It's easier to just do it with the plus and minus functions, but it can really make a mess. Obviously LabVIEW should allow functions with true polymorphic inputs, but while I'm waiting for that, I thought maybe they could throw in the PlusAndMinus for me. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.