Formula node- using C

Hi there,
I need to create a vector and for that I am using the formula node. I am doing that in C ( in which I really am a beginner) whereas in MATLAB the program some time runs some time it does not.
Attached is the program,  the error list says:
 Error on line 3 is marked by a '#' character: "  int32  j; double# Rv[14]; Iv[14]; for "
Can anyone help?
thank you in advance
Solved!
Go to Solution.
Attachments:
sum.vi ‏8 KB

You have 2 syntax errors on that line.  The proper term is not double but float64.  And separate the two arrays with a comma and not the end of statement semicolon.
Make it look like this and the broken run arrow goes away.
float64 Rv[14], Iv[14];

Similar Messages

  • Dead loop in formula node

    Hi,
    I have encountered the following problem in a formula node. Everything seems simple and right. But there is no output and the loop goes on forever. The sizes of both input arrays are the same. Need your advice. Thanks.
    Rut
    Attachments:
    Algorithm.vi ‏11 KB

    Look, I am far out on a limb here, because I am not a C programmer. Whatever you're doing would make more sense from a FORTRAN point of view.
    The LabVIEW formula node uses BNF notation (check the help), which is in many ways C like. So the syntax for a FOR loop is:
    for ( InitExpression ; CondExpression ; LoopExpression ) Statement
    This means the loop iterates until "CondExpression" is true.
    Do a google search on "C For loop" and you might find for example pages like:
    http://www.hitmill.com/programming/cpp/forLoop.htm
    http://www.geocities.com/learnprogramming123/Clesson8Beginner.htm
    Your condExpression is "n1-1", which, during the execution of the node is a constant. For example if you array size is 50, n1-1=49, FOREVER! The condition is never true so the loop will never stop.
    I hope somebody more knowledgable will chip in at one point.
    LabVIEW Champion . Do more with less code and in less time .

  • Formula node, condition

    I want to use conditional expressions such as
    if () then
    statement
    else
    end if
    in the formula node, but there were error messages "unassigned output".
    I followed Ankita's suggestion to use
    if (x<5)
    y=4;
    z=8;
    else
    y=8;
    z=4;
    but there were same error messages(I tried "end if;" also.).
    Thanks.

    Which version of LabVIEW are you using? Any chance it is earlier than 6.0?
    If so, then Ankita's suggestions probably won't work, because there were major changes in Formula Node behavior. I recall that every variable introduced in pre-6.0 formula nodes had to be explicitly added as either an input terminal or an output terminal on the formula node. Furthermore, those older formula nodes used a different style for conditional syntax. It's all documented in the manuals or help documentation that shipped with your LabVIEW version, whatever that may be.
    More to the point, I suggest that you abandon the formula node for simple conditionals like this and just use a case statement. You can wire your x variable into a less-than node, then wire the output of that into a case statement selector. You can very often avoid formula nodes by using case statements or even the "Select" node on the Comparison palette.
    My two cents,
    John

  • Can I use a formula node to start the execution of a case structure?

    Hi,
    I am working on editing a VI to make it much easier to understand (for colleagues and non LV users). For one reason or another, the VI's creators did not fully make use of the power of case structures and other structure types. In the application we need it for, the instrument cycles and repeats measurements on several objects. We are interested in measuring the motor currents for several motors in the system. As it stands now, for each sample object's run, there is a separate sub-vi diagram which displays its waveform trace and several indicators such as max current, time at max, etc. That code was contained within a T/F case structure and copied and pasted 20 plus times.... Obviously the vi became extrememly cluttered and needed a huge screen to see. The trigger for the current case structures is an EQUALS comparison between one input (which is the sample object counter; and this part I will likely leave unchanged since it makes a lot of sense already) and a constant which was defined 1 through 20+ for case. 
    I have since made one case structure and 20+ instances of that case and have labeled them (at the top selection box near the detent arrows) "1", "2", 3, etc. I am wondering if I can use a formula node to act as the "trigger" which sets each case structure running? I believe that a simple IF statement should work. Please see a snippet of my attempt at making this in C below.
    For the node, I defined X as the input and Y as the output. The input to the node, X, is connected to the sample object counter. The output, Y, is connected to the case selector of the case structure. My attempt at the code is below:
    int32 y
    For(x == 1)
       y = "1";
     For(x == 2)
       y = "2";
    etc, etc.
    Is that above code snippet correct? Do i need something like "ENDIF" or "end if" at the end? Does "y" have to be defined as "int32" or can it be something else?
    Thanks for the help!

    Is your formula node doing anything else besides what is shown?
    Why don't you just wire the value that is going into it at X directly into the selector of the case structure?
    Attachments:
    Example_VI_BD.png ‏2 KB

  • In formula node how to use array outputs

    someone has talked about this. but it is still a problem to me.
    no matter how i declare the variable, the output terminal keeps a scalar.

    You should be able to declare it using:
    int32 VarName[x][y];
    That should make an array of 32bit integers.
    See one of my earlier posts here: http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=506500000008000000EE2C0000&UCATEGORY_0=_49_%24_6_&UCATEGORY_S=0&USEARCHCONTEXT_TIER_0=0&USEARCHCONTEXT_TIER_S=0&USEARCHCONTEXT_QUESTION_0=array+formula+node&USEARCHCONTEXT_QUESTION_S=0
    Try copying the code that I posted into your formula node and see if you get an array out. Or try the example I attached with the same code in it.
    Let us know if you are still having trouble.
    Brian
    Attachments:
    ArrayFormulaNode.vi ‏23 KB

  • 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

  • Using a x b in formula node

    Hi, I am trying to use the following code snipped in formula node:
     z=(x-2.5)*50;
    if (z>-10.0||z< 10.0) {
    y = 0;
    c=0;}
    else {
    y = 5*x-12.5;
    c=1;}
    x is input (from cRIO) and z, y, c are outputs .
    It doesn't seems to work properly, y, c are always 0.
    How else can I use compound evaluation: -10<z<10 ????
    Thanks,
    Arthur
    Solved!
    Go to Solution.

    replace || with &&
    LV 8.2 at Windows & Linux

  • Formula node forbid to run VI when undefined variable is used

    On all LabVIEW version, we can use Formula node to evaluate mathematical formulas.
    We can define input and output variable freely and calculate using some variety of formula.
    But when we use undefined variable as output, can execute VIs with no errors.
    We think it is a problem because when programmer makes a typo, they cannot notice the mistake.
    When undefined variable is used as output variable, LabVIEW should forbid to run VI.

    I think you are going to get the same (or similar) answers than to my suggestion(s) to make VI outputs potentially "required" and the same for some functions (built-in VIs):
    http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Allow-required-outputs-in-VIs/idc-p/3157058
    http://forums.ni.com/t5/LabVIEW-Idea-Exchange/quot-Function-terminal-not-connected-quot-detection-plus/idi-p/1858573
    In general, I agree with you, there is a potential for problems. Not really for the reason you are mentioning, because a typo will break the VI (unless you have two output variables with very similar names - unlike in your example - such as y and y0). But it could make for some frustrating debugging session.

  • Formula Node cannot use "fabs"? Anyone can help me?

    I want to use "fabs" in the formula node, but it appears the "undefined variable" information, showed in the following picture. Does anyone know how to solve it? Thanks a lot!
    Solved!
    Go to Solution.
    Attachments:
    fabs.jpg ‏14 KB
    error.jpg ‏11 KB

    xiaoquan wrote:
    Yes, I tried.  It can be accurate to six decimal places.  I tink  maybe it is the limit of DBL. Do you know some other way to increase the accuracy? Thank you very much!
    That is simply not true! Make sure you change the display format of the indicator to show enough digits.
    (right-click...display format...)
    (If you still have problems, please attach your code with some typical data.)
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    AbsDBL.png ‏6 KB

  • 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.&nbsp; 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..

  • 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 simulate waveform using formula node

    is it posible to get waveform using formula node.for example,i want to calculate Vo=Vs sin wt,in formula node,i use
    V*sin*2*pi,how to use the answer to plot waveform

    or if you REALLY want to continue it the way you had (not sure why you would)...
    Use the rating system, otherwise its useless; and please don't forget to tip your waiters!
    using LV 2010 SP 1, Windows 7
    Attachments:
    build[1].vi ‏16 KB

  • Using the Formula Node for PDA

    I get a compile error when I use C code inside the formula node. Is it possible to use C Code inside the formula node for PDA applications? Do I have to include any file while building the executable for the PDA

    Ok, I was able to successfully build an executable file without error. I attached the screen shots of your program in execution. Does this look like the desired result?
    I'm confused as to why I can build and run the program on my machine. I have LabVIEW 7.0 and Windows XP. What version of Windows and LabVIEW are you using? Also, are you getting the error window when you try to build an executable or when you attempt to run the VIs within LabVIEW?
    Regards,
    -Joe-
    Attachments:
    tutor.JPG ‏100 KB
    tutor2.JPG ‏122 KB
    detector.JPG ‏46 KB

  • XY graph using formula node

    In a formula node there is one input(x) and two outputs(y1,y2).
    Plot y1,y2 on a single XY graph for different x1 values(from 100-200). please reply...
    regards,
    jathin
    Solved!
    Go to Solution.

    Hi Jathin,
    this sounds like a school assignment. This forum isn't intended to do other peoples homework.
    This assignment also is very basic stuff, which should be easily to solve after going through basics course offered by NI...
    And, as said before, we will help to develop code as soon as you attach your work here. We will not write stuff from scratch...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • When is best to use a formula node?

    Hello:
    I just started wondering when would be a good situation to use a formula node??. It's just to save space in the diagram if there's the need to create a complex arithmetic operation?? Wouldn't it be better to just use G??
    Robst - CLD
    Using LabVIEW since version 7.0

    The only time I use a Formula Node is when I need to enter an equation (which is not very often).  Here's a VI I wrote just the other day that was simply faster to write, and probably easier to understand mathematically, than attempting to wire up the same thing.
    -D
    Message Edited by Darren on 02-09-2006 01:32 PM
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman
    Attachments:
    formula_node.jpg ‏44 KB

Maybe you are looking for

  • SAPSQL_ARRAY_INSERT_DUPREC in tcode F-22

    Hi Experts,                 In T-code F-22 after generating document number i m getting error "Update was terminated" and Exception " CX_SY_OPEN_SQL_DB"  . I m providing here log file in ST22.                Error in the ABAP Application Program     

  • AD Trusted Reconciliation Issue in OIM 11g R2

    Hi, I am trying to reconcile the users from AD(Trusted Source) to OIM 11g R2. I gave object class as User. and User ID in search filter but by default ObjectCategory is getting added in my search filter. so my search query ends up something like.. (&

  • How to split the invoice

    Hi, I have number of outbound deliveries for the same customer and ship to party. While invoicing them it is creating only one invoice. But my requirement is to create, one invoice for one outbound delivery. Could anybody tell me how can I control it

  • CFB2 Plugin Issue

    I just upgraded to CF Builder 2 yesterday. I did a clean install along with grabbing version 3.6.2 64 bit version of eclipse. Everything was fine at first but now any time I launch eclipse and the Builder Plugin starts up I keep seeing a message in t

  • Sharing a printer from an OS 9.x Mac.

    Hello Forum Folks, I have a MacBook running Tiger connected on a home network to a PowerMac G3 running OS 9.2 & I can successfully share files between the two. There's a HP Deskjet 870Cxi printer hooked up to the G3 via the mac serial port. My questi