BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Minutiae (that may bite you someday)

Highlighted

Here is one involving X-Controls.

 

Xcontrols are a bit complicated to configure, so it might not be clear what it means if the "data changed?" boolean in the action cluster is set to true.

 

For example, there is an event case name "Data Change", and the programmer might think that "data changed?" needs to be set to TRUE in that event case. (After all, if you write to a terminal, the data changes in some way, right? 😉 ...wrong! 🐵

 

Bad idea, but you might never notice a problem until you do some profiling:

 

If "data changed?" is set to TRUE in the "Data Change" event of an xcontrol, writing to a plain local variable of the xcontrol in the main program actually fires any "value changed" event associated with the xcontrol, same as if you would write to a value(sgnl) property. This can lead to unexpected behavior. 😉


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 31 of 131
(5,293 Views)
Highlighted

Wow! I just learned one that threw me for a loop! I rarely use the Expression Node, so when I tried to generate a simple parabola out of instinct I tried "x^2 + 2*x". You can imagine I was shocked to see the following drunken graph:

 

19921i34FC20B09629F5A1

 

 

 

Apparently, the '^' operator is the XOR operator, not "to the power of" like I expected. This was clearly evident for such a simple formula, but could be much more insidious in a complex formula.

 

See here for the original thread where I ended up using "x*x + 2*x" as the example.

Wirebird Labs: Expert Toolkits for LabVIEWDeploy, by Wirebird Labs: Expert Toolkits for LabVIEW
Message 32 of 131
(5,221 Views)
Highlighted

 


JackDunaway wrote: 

 

Apparently, the '^' operator is the XOR operator, not "to the power of" like I expected. This was clearly evident for such a simple formula, but could be much more insidious in a complex formula.

 

See here for the original thread where I ended up using "x*x + 2*x" as the example.


Not sure if you discovered it in your research, but ** is "to the power of".  i.e.  "x**2 + 2*x"

 

--
Tim Elsey
Certified LabVIEW Architect
Message 33 of 131
(5,194 Views)
Highlighted

The few syntax differences (formula node vs. parser) are a bit of a weak point and can be confusing.

 

Here is a list of some differences.

 

excerpt from the help:


The parser in the Mathematics VIs supports all elements that Formula Nodes support with the following exceptions:

  • Variables—Only aa0, ..., a9, ... zz0, ..., z9, are valid.
  • Logical, conditional, inequality, equality—?:,, &&, !=, ==, <, >, <=, and >= are not valid.
  • Functions—atan2, max, min, mod, pow, rem, and sizeOfDim are not valid. You can use these functions in a Formula Node or use their corresponding LabVIEW functions.

...

The following table lists cases where Formula Nodes and the parser in the Mathematics VIs use different syntax.

ElementFormula NodeParser VI Routine
pi pi(1) =, pi(2) = 2, 2pi or 2(pi) return an error
Exponentiation ** ^

The precedence of operators is the same for the Mathematics VIs as in Formula Nodes. Refer to Formula Parsing VIs for more information about specific Formula Parsing VIs.

The parser in the Mathematics VIs uses the following syntax:

function (argument)



LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 34 of 131
(5,180 Views)
Highlighted

Have you ever heard of "Coerce to Type"? You may not realize you need this function to squash bugs waiting to happen in data type conversions and typecasts.

Wirebird Labs: Expert Toolkits for LabVIEWDeploy, by Wirebird Labs: Expert Toolkits for LabVIEW
Message 35 of 131
(5,071 Views)
Highlighted

I try to configure a case structure in a way that one case matches all the input strings started with "CurrentMeasurement" (and others.)

 

This results TRUE, if the input = "CurrentMt" and also TRUE if input = "Currenteasurement". But FALSE for "CurrentMeasuremen"


So what is the rule? In the help I find only hints for string ranges, for example stringe begin with a and b should be "a..c"

 

case.gif

 

Mitulatbati

0 Kudos
Message 36 of 131
(4,670 Views)
Highlighted

 


@mitulatbati wrote:

I try to configure a case structure in a way that one case matches all the input strings started with "CurrentMeasurement" (and others.)


This looks like a normal question looking for help, so please post it as a new thread in the LabVIEW forum.

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 37 of 131
(4,667 Views)
Highlighted

 


@mitulatbati wrote:

I try to configure a case structure in a way that one case matches all the input strings started with "CurrentMeasurement" (and others.)

 


You just gave me an idea for the idea exchange. What if the string could be a regular expression?

 

=====================
LabVIEW 2012


0 Kudos
Message 38 of 131
(4,606 Views)
Highlighted

If an event structure is registered for an event but does not have a case for that event then firing that event will still reset the timeout timer for the structure.

 

Some people consider it a bug and others consider it to be expected behavior.

 

There is an interesting debate on Lava about this.

 

timeout.png

 

Anyone know why creating a snippet converts a control reference into a control?

 

=====================
LabVIEW 2012


Message 39 of 131
(4,595 Views)
Highlighted

 


@SteveChandler wrote:

 

Anyone know why creating a snippet converts a control reference into a control?


Because NI wants to encourage people to use the Code Capture Tool which doesn't have this issue and can back-save your snippet as well?

 


___________________
Try to take over the world!
Message 40 of 131
(4,572 Views)