Bug using array in formula node, LV6.0

Pass a 3-element integer array, containing values 5, 6, 7 into a formula node as input variable x. Pass variable y out. The formula node contains:
int32 y;
y = (x[2]-x[1]);
My result is 6. If the parentheses are removed, the answer is 1. Apparently adding the parentheses causes the expression to be evaluated as y = x[2-1];.
Has this been found/fixed? I have mailed NI separately.

In 6.0.2 it returns 1 in both cases.
"Adam Russell" wrote in message
news:ajcc8d$1a266r$[email protected]..
>
> "Bill Atkins" wrote in message
> news:[email protected]..
> > Pass a 3-element integer array, containing values 5, 6, 7 into a
> > formula node as input variable x. Pass variable y out. The formula
> > node contains:
> > int32 y;
> > y = (x[2]-x[1]);
> > My result is 6. If the parentheses are removed, the answer is 1.
> > Apparently adding the parentheses causes the expression to be
> > evaluated as y = x[2-1];.
> > Has this been found/fixed? I have mailed NI separately.
>
> It works correctly in 6.1. I'm at home so I can't t
ry it in 6.02.
>
>

Similar Messages

  • Why do I receive Error -23088 when using the Eval Formula Node.vi (LV6.1)?

    Hi,
    I want to evaluate formulas like x=v>20; with that vi. When typing the
    same formula into an normal Formula Node I get the correct answer. When
    changing the formula into x=v+20; the eval Formula node.vi works fine.
    But whenever I try to resolve a boolean function like that mentioned
    above, I receive that f****n Error! Why this? What can I do? Is the Eval
    ... .vi less powerfull than the normal node?
    Thanks for your help,
    Daniel

    Joel A wrote:
    > I think the boolean (binary) ops are the only difference between the two nodes.  I pulled this from the help:
    > Formula Node and Expression Node Functions
    >
    > The following list contains the names of the Formula Node and Expression Node functions, and their descriptions. Except for the binary functions, you also can use these functions with <a href="gmath.chm::/Parser_VIs.html" target="_blank">Formula VIs</a>. All function names must be lowercase. You also can use <a href="mk:@MSITStore:C:\Program%20Files\National%20Instruments\LabVIEW%208.0\help\lvhowto.chm::/Precedence_of_Operators_in.html" target="_blank">operators</a> and the pi constant in Formula and Expression Nodes.
    > Start at the help above, and see if you can find any helpful information.
    > &nbsp;
    > &nbsp;
    > J
    Thanks for help,
    I solved the problem by using the "Parse Arithmetic Expression.llb" from
    examples. You can modify it and add the operators you need..

  • String array into formula node

    Hello,
    I am taking data from SQL, I am getting multiple rows of data for many different devices. I would like to wire the data into a formula node so I can sepearate and sort via script. However, I am getting an error for "Polymorphic terminal cannot accept this data type". Is there a work around? Can I not wire in a string array to a formula node.
    /r
    Travo

    There are lots of basic string VIs that you can use to parse the string and separate out the individual fields. I would recommend "programming" your application using script nodes. Use the native language. LabVIEW is a fully functional and capable programming language.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Can I create array inside formula node

    I need to create and use array (multidimensional) inside a formula node. My LabVIEW version is 5.1.The input and output from/to formula node do not necessarily being array. Thank you.

    You need to declare a variable to be an array. To declare a multidimensional array of 32 bit intergers enter this:
    int32 VarName[x][y];
    Where x=1st dimension size (rows) and y=2nd dimension size (columns). You can then operate on this like you would an array in a text based language. Try the entering the example below in a formula node.
    int32 i;
    int32 y[5][2];
    for (i=0;i<5;i++)
    y[i][1] = x[i]+1;
    Where y is an output and x is an 1D array input.
    Hope this helps...
    Brian

  • Shift Register while Indexing Arrays in Formula Node

    Hello, 
    I am having trouble using the formula node while indexing my two arrays.  I keep getting "NaN" for my output array. I believe the problem lies within my shift register.  My guess is that for the first calculation there is not a PreviousAngle so that is why it is giving me "NaN."  For the first index I would like the value of the PreviousAngle to be 0. I am new to LabView and unsure what to do.
    Thanks!
    Christian Seymour
    Solved!
    Go to Solution.
    Attachments:
    Complementary Filter.vi ‏21 KB

    The shift register should contain 0 by default since you are using a double [if uninitalized, the shfit register takes the default value of the data type.  In this case, the default Double is 0], but you should explicitly initalize the shift register to a default value in most cases.
    To do so, right click on the "previous angle" shift register and select "Create constant".  This will create a Double value of 0 to fill in the register for the first calculation.
    If you need a number other than 0 to start, you can just change this constant.
    **Note:  This is a good habit to have.  Shift registers retain value as long as the VI is in memory.  So if you run this more than once, it will have the value from the last execution automatically!  This is usually unintended behavior for new LabVIEW users -- however you can sometimes take advantage of this feature in some applications and make it intended behavior
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    If someone helped you out, please select their post as the solution and/or give them Kudos!

  • Array in formula node

    Hello everyone,
    I am new in labview. I would like to display the coherence function with the correct frequency scale. For instance, I want it to be as follow: FreqAxis = 0:Fs/2/(N+1):Fs/2. where Fs is the sampling frequency and N the number of sample. I am trying to write using Formula node, but it is not working.
    Thanks for your time and your help.
    Axel

    Thanks again for your comments and your time .
    I have attached the .vi file and a screen-shot of the expected result (cohere2.png).
    Cheers
    Axel
    Attachments:
    Code_frequency.vi ‏531 KB
    cohere2.PNG ‏17 KB

  • Using arrays with formulas

    I'm having trouble getting my arrays to work in the formula that I need to use to calculate a monthly mortgage payment, which is what I need to do. I'm supposed to use arrays to store three different term year amounts and three different interest rates, and then display the monthly payment and other info for each amount. Can someone help with this? I keep getting errors that say "cannot use operator / or * with double[]". Here is my code:
    class PaymentArray {
         public static void main(String[] arguments) {
              double amount = 100000;
              int[] term = {7, 15, 30};
              double[] rate = {.0535, .055, .0575};
              double payment = (amount*(rate/12))/(1-(Math.pow(1/(1+(rate/12)),(term*12))));
              for (int i = 0; i < term.length; i++) {
                   for (int j = 0; j < rate.length; j++) {
                        System.out.println("If the initial loan amount is " + amount);
                        System.out.println("and the length of the term is " + term + " years");
                        System.out.println("and the monthly interest rate is " + rate);
                        System.out.println("The monthly payment will be " + payment);
    }Any help would be greatly appreciated. Thanks!!! :-)

    That all worked really well, thanks so much!!!
    The only problem I have now is, instead of calculating the payments at 7 years/5.35%, 15 years/5.5%, and 30 years/5.75%, it's calculating them for 7 years at 5.35%, 5.5%, and 5.75%, 15 years at 5.35%, 5.5%, and 5.75%, and so on. I don't need it to do all of that, I need the years to correspond to the correct interest rate. How can I change that? Thank you so much. Here is my new code:
    class PaymentArray {
         public static void main(String[] arguments) {
              double amount = 100000;
              int[] term = {7, 15, 30};
              double[] rate = {.0535, .055, .0575};
              for (int i = 0; i < term.length; i++) {
                   for (int j = 0; j < rate.length; j++) {
                        System.out.println("If the initial loan amount is " + amount);
                        System.out.println("and the length of the term is " + term[i] + " years");
                        System.out.println("and the monthly interest rate is " + rate[j]);
                        double payment = (amount*(rate[j]/12))/(1-(Math.pow(1/(1+(rate[j]/12)),(term*12))));
                        System.out.println("The monthly payment will be " + payment);

  • Log10 used in a formula node

    I am trying to create a formula using log10(X) in a formula node.  I can enter log(X) with no errors, but when I enter log10(X) I get an error.  How do I use log10 in a formula node?  Is log(X) actually log10?
    Alan

    Hi Alan,
    by reading the context help of the formula node ("click for more help" ) I found: log(x) is base10, otherwise you may use ln(x) or log2(x).
    Message Edited by GerdW on 12-17-2008 08:26 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How to use matlab program in formula node in labview?

    hi,
    i've got one equation of voltage regulation. so i did create program for that in matlab.and want to use it in formula node in labview.but i don't know how to do that.can someone please help me for that?
    regards
    bhavin

    If you have already written Matlab code it is easier to import it straight into a Mathscript node. If you use a Formula node you need to translate m- syntax to c-syntax which may take longer. Note that the Mathscript node
    may not support all the functions you used in Matlab so you may need to replace them with native LabVIEW functions. If you want to add inputs/outputs in your program you can just right-click on the border of the node to do that.
    These structures can be on the block diagram under Programming>> Structures.
    KostasB
    NI UK Applications Engineering
    Message Edited by KostasB on 05-28-2008 08:39 AM
    Attachments:
    mathscript-form node1.PNG ‏8 KB

  • Really need Min(a,b) and Max(a,b) function in "Eval formula node"

    Hi all,
    I've been using the 'Eval formula node" to let the user of my app configure his own calculations,
    but now I've found out that the "Eval formula node" doesn't support these functions.
    e.g        y= min (a,b)
    or         y = max (a+3, c-4)
    I considered adding them myself to the Eval formula node's subvi's,
    but franckly I've never seen such complex subvi's :-)
    Is pretty urgent. Any ideas?

    MegKB wrote:
    Maybe the MathScript node is the way to go now, as long as you want to install MatLab.
    The MathScript node does NOT need Matlab.  It runs Matlab-like code, but it is totally inside of LabVIEW.  There is a Matlab node that uses ActiveX to run Matlab.  For that you need to have Matlab installed.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How can I programatically perform a conditional formula in "Eval Formula Node"?

    Okay, I'm stumped. I have an application where I need to evaluate a conditional programatically, and I can't do it with a Formula Node.
    Basically, my user wants to be able to enter some formula which describes conditionals, such as "if this temperature goes above X degrees or this temp goes above Y degrees, then take a reading" kind of thing. Since the conditional will be saved in a file, the formula node needs to be dynamic.
    I've used the "Eval Formula Node" before, which is built for this type of application...sort of. I tried it, but after trying in vain to get it to work properly, found out that it doesn't do boolean and conditionals in its parser, so it won't work.
    Does anyone
    have a good idea how to do this??

    Why do you even want to use the formula node at all? I don't think you "can take a reading" (i.e. interact with hardware) inside a formula node anyway.
    The formula node allows conditionals, see e.g. the example in the online help (image attached).
    You could also use a case structure with seperate formula node in each case.
    I highly prefer to skip the formula node and use wires instead. It will be more efficient and also much easier to debug. A formula node is not "in the true spirit of LabVIEW" ;-)
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    FormulaNode.gif ‏2 KB

  • Atan2 equivalent in a Formula Node?

    Does anyone have an atan2 (2-input inverse arctangent) equivalent for use in a Formula Node? I was surprised to see that such a common function wasn't supported in Formula Nodes. Without it, my easily readable Formula Node equations get junked and become a nightmare of LabVIEW math symbols. Is there a way to call the atan2 VI (or any other VI for that matter) from within a Formula Node?

    Hello,
    You are correct, this function is not supported in Formula Nodes, and there is not a way to call VIs from formula nodes. However, the below solution might be what you need:
    Is this the correct definition of atan2:
    if y = atan2(a,b), then tan(y) = (a/b)
    If so, could we define a and b, and use the formula node function atan(a/b)? This may not be the most elegant solution, but it seems like it would do the trick with minimal headache. I attached a VI showing this idea.
    Hope this helps!
    Liz Fausak
    National Instruments
    Attachments:
    atan2FNode.vi ‏10 KB
    61atan2FNode.vi ‏10 KB
    60atan2FNode.vi ‏8 KB

  • Formula node parenthesis problems

    Hi Y'all,
       I'm going cross-eyed trying to figure out what is wrong with the equation that I'm trying to use in a formula node. I've attached both the VI (version LabVIEW 2009) and the error msg. Unfortunately there are a couple more of these, but maybe if I get the problem with this one pointed out to me ...
    Thanks!
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion
    Solved!
    Go to Solution.
    Attachments:
    Calculate Discharge coeff.vi ‏7 KB

    Ha ha ha, thank goodness for Mac's. When I went back and replaced all the "-" with "-" it fixed the problem. The problem was that I had copied/pasted from a pdf document, and what was displayed in the formula node wasn't what it was seeing! So much for WYSIWYG!
    What a PAIN! It didn't say "What the heck is this weird character", told me that I alternately was missing a right hand parenthesis, or a semi-colon.
    Thanks,
    Message Edited by LV_Pro on 10-21-2009 12:39 PM
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • Updating equation in formula node from a string or text file

    Is it possible to have a calculation performed based on an equation stored in a string (read from a text file). I am guessing not because the equation would need be compiled but thought I would ask.

    Hi,
    it depends on how complex the equation is.
    Rather than using a formula node, you could use the eval formula node vi instead. (Functions->Analyze->Mathematics->Formula), but you may needs to re-organise the text formula a little.
    Assuming you're using not the base package, and atleast LabVIEW version 6.1 that shouldn't be a problem.
    Hope that helps.
    Sacha Emery
    National Instruments (UK)
    // it takes almost no time to rate an answer

  • Formula node uotput variable

    If i use two different formula nodes with the same output and input variable names will the variables (scope) be the same? In the first formula node i define a variabe "int32 first ==0" then in a seperate node embedded in a for loop structure I write " if(first==0) first = chan;". That way the variable "first" is set equal to "chan" only once through all acquisitions of the for loop b/c "first " only equals 0 at the beginning of the loop. My problem is that after running the program more then once the value of "first" remains the same regardless of the new value of "chan".

    I believe that the variables are local to the formula nodes themselves.
    Therefore, in your first formula node, first is set to 0. In the second, if you don't define an initial value, it is assumed zero. So the first time through, it will get set to the value of chan. But the second time through, it already equals chan in the second formula node (not reset by the first formula node--they are separate variables). Therefore, it will never go to a new value of chan until it is reset to 0.
    Mark

Maybe you are looking for

  • Running total with specific criterea

    Hey Everyone, Quick question I hope. I have report that we want to add a running total of all records in the report that contain the numbers 1100 to 1400. What I have been trying to currently do is create running total sum that uses a formula to eval

  • Scrolling with Magic Mouse in Firefox

    Occasionally, maybe once per day, when I open the Bookmarks menu in Firefox, my Magic Mouse won't scroll up or down. I close the menu, open it again, and the Magic Mouse works fine. The Firefox Bookmarks menu is the only place I've noticed this or an

  • How to install add-ons for Pemiere Elements 13

    How to install add-ons to Premiere 13. I bought it together with Photoshop Elements in electronic version from Adobe.com page. But I dont have link to 2nd DVD with Premiere Add-ons. How to install that files ?

  • OSX mountain Lion requirements

    Hi, Trying to upgrade fro OSX 10.6.8 to Mountain Lion, AppStore won't to do that saying it is not compatible. It might be the machine I'm using. However, on the OSX Tech Spec page it is noted only: "MacBook Pro (Mid/Late 2007 or newer)", which is not

  • Most Popular/Second Most Popular

    I am trying to retrieve the most popular STATION used. If there is a tie, choose the most recent DESCRIPTION (Table 2) and use the other for second most popular. The tables are joined by TUB TABLE 1 ID     TUB     STATION 100000     1002     3 100000