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

Similar Messages

  • How to convert String array into int.

    void getSoldSms(Vector vecSoldSms)
         String str[]=new String[vecSoldSms.size()];
         String words[]=new String[str.length]; // String array
              for(int i=0;i< vecSoldSms.size();i++)
                   str=(String)vecSoldSms.get(i);
              }               //End for
              for(int i=0;i<str.length;i++)
              words = str[i].split("\\|\\|");
              System.out.println();
              for(int j=0;j<1;j++)     
              int count[str.length]=Integer.parseInt(words[i]);
              System.out.print(count[j]*advance_count);
              } // end inner for loop
              }          //End for
         }          //End function getSoldSms
    how do i convert words which is a string array into int type. i kno string can be converted into int using interger.parseint. but wat abt string arrays??? plz help me out with the above code.

    i did tht its still giving the same errorFor Heaven's sake, what about taking a second to try to understand the code you're copying first? If you really can't fix the error yourself, you have a more serious problem than just convertingStrings to ints.
    And if you want { "1", "2", "3" } to be 123:
    StringBuffer b = new StringBuffer();
    for (int i = 0; i < array.length; i++) {
      b.append(array);
    int result = Integer.parseIn(b.toString());

  • 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.
    >
    >

  • 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

  • Write string array into cfg file

    Hi, everybody.
    I faced the problem to write array into cfg file. I am trying to put many items in a key. It should look like
    [Section1]
    Key1=el_1, el_2,el_3,.............el_n.
    each element is string of 105 characters. Everything works fine when I save the only one el_1 or multiple for the  first time, however, when I am trying to update values in a key section some extra strings appear in a file. My VI is attached.
    Thanks in advance

    Do you realize that your spreadsheet string only writes the following:
    1111111111
      2222222222222222
     33333333333333333333
    The way you wrote your VI, it sends the entire string above to the value for Write Key.vi.
    Do you realize that value is for the data type only?  So I'm not sure what you want to do....
    Without describing the problem you are having, can you describe what you actually want to do?
    R
    Message Edited by JoeLabView on 07-22-2008 11:49 AM
    Attachments:
    confused.PNG ‏26 KB

  • 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

  • Huge String Array into smaller different arrays

    Hello,
    I have an requirement wherein i'll be getting a huge array of Strings (say 10000) elements. This number is variable.
    Now i have to break the same into smaller chunks/arrays (say 100 element each).
    Thanks,
    Piyush

    Hi,
    try this.
    TYPES :
      BEGIN OF type_s_fs,
      field(100) TYPE c,
    END OF type_s_fs.
    DATA fs TYPE type_s_fs.
    DATA itab LIKE STANDARD TABLE OF fs.
    DATA itab1 LIKE STANDARD TABLE OF fs.
    DATA w_d TYPE i.
    w_d = STRLEN( w_c ).-----> ( Declare ur longstring here  with w_c )
    DIVIDE w_d BY 100.
    add 1 to w_d.
    DATA w_t TYPE i.
    DO w_d TIMES.
      fs-field = w_c+w_t(100).
      APPEND fs TO itab.
      CLEAR fs.
      ADD 100 TO w_t.
    ENDDO.
    LOOP AT itab INTO fs.
    write :/ fs-field.
    ENDLOOP.
    With this u can split at 100 characters into single internal table.
    Now , loop at this table and assign each record to required internals tables just by reading 1 row.
    Or
    make use of fieldsymbols.

  • Read/Write 2d numeric array or string array into bin file

    Can anyone pls help me to resolve this problem
    Attachments:
    bin file.vi ‏9 KB

    You are still using the wrong format.
    Whatever you are doing has nothing to do with a binary file.
    You are still using way too much duplicate code.
    All you probably need is read/write from spreadsheet file, no need to reinvent the wheel.
    Your code will fail if the numbers contain decimal digits (since your array is DBL, it could! If your array only contains integers, you are using the wrong numeric representation).
    You string code will fail if the array elements contains tabs, for example.
    You still don't need a sequence structure.
    LabVIEW Champion . Do more with less code and in less time .

  • Parsing String array

    Hi, I need some help on parsing an string array into floating array. Here is the sample in put:
    String s[1] = 4.2 3.8 5.6 5.4 6.1 4.9 6.0 5.88 6.8;
    float []f = new float[9];
    How am I parsing each of the element of the s[1] into f[0]....f[8]?
    f[0] = 4.2, f[1] = 3.8, ......., f[8] = 6.8;
    thanks a lot

    Hey bud,
    Ever heard of StringTokenizer? That will allow you to get each value out of s[1] that is seperated by a space and then you can loop through getting each value and putting them in your array of floats, but of course you are going to have to convert them into floats if you want to use the float primitive datatype;
    You can tokenize your string array like this:
    StringTokenizer st = new StringTokenizer(s[1]);God Bless,
    Bruce

  • Array init in formula node

    I would like to cut and past in a list of comma seperated numbers and initialize an array of float32.  Something like this would work in C.
    float32 data[5] = {0,1,2,3,4};
    Labview does not like this syntax when using a formula node.  I have to do the following instead
    float32 data[5];
    data[0] = 0;
    data[1] = 1;
    What is the correct syntax for initializing arrays in lavview using a formula node.  I would be amazed if Labview does not have this basic functionality.
    thanks in advance
    jim bob

    labview_noob wrote:
    ttt, no one?
    Probably because we are using LabVIEW to get away from text based code.
    (I don't know if there is a syntax for the formula node, it's been too long. )
    If you have LabVIEW 8.0 or higher, you can use matlab like sytax in a mathscript node. Of course you could just paste your list into a string constant and get the values with "spreadsheet string to array".
    Message Edited by altenbach on 07-25-2007 12:24 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ArrayFormula.png ‏13 KB

  • How do I determine array size in a formula node

    I am feeding an array into a formula node to perform an operation on. However the size of the array can be an arbitrary size. How can I determine its size to use for iterating through a for loop?
    I suppose that I could add another input that is fed with the array size from the array palate but I would like to know if it can be done inside the formula node itself.

    Your own advice is the only and best one.
    greetings from the Netherlands

  • 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

  • Array output from formula node with input variable as array size

    Hi,
    I have created a formula node with an array output called al, but I get an error "you have connected a scalar type to an array with that type".
    I declare the output as follows..
    float64 al[len_as];
    where len_as is an scalar input to the formula node.
    It only works when I put a number as.
    float64 al[5];
    ,but I don't know beforehand how many elements I need, so I cannot use this.
    Please help! This is so stupid.
    Thanks

    Don't define your array in your formula node.
    Initialize the array as the size you want and pass it in as an input into the formula node.
    Are you sure you even need to use a formula node?  Can you implement your formula using all native LabVIEW functions?
    Message Edited by Ravens Fan on 10-07-2009 11:51 PM
    Attachments:
    Example_VI_BD.png ‏3 KB

  • Array index problem in formula node

    dear friend
    I'm trying to use formula node to solve a problem because I make this program using c at the begining.
    It runs perfectly in turbo c, but somehow it doesn't work in the formula node.
    I try to debug my source code, and I find that the formula node seems can't read the true value in
    the array.
    Here is the code in the formula node.
    int32 i,j,k;
    for ( i = 0 ; i < sopa; i++ )
     j = 1;
     ep[i][0] = pa[i];
     ep[i][1] = np[ep[i][0]][0];
     while ( ep[i][j-1] != exit )
      for ( k = 0 ; k < sonp ; k++ )
        if ( np[ep[i][j-1]][k] != -1 && (pc[ep[i][j-1]][ep[i][j]] + pc[ep[i][j]][exit] >= pc[ep[i][j-1]][np[ep[i][j-1]][k]] + pc[np[ep[i][j-1]][k]][exit] ) && (pc[ep[i][j-1]][np[ep[i][j-1]][k]] == org[ep[i][j-1]][np[ep[i][j-1]][k]] ))
          ep[i][j] = np[ep[i][j-1]][k];
      j++;
    This is the part that I think the problem might be.
    if ( np[ep[i][j-1]][k] != -1 && (pc[ep[i][j-1]][ep[i][j]] + pc[ep[i][j]][exit] >= pc[ep[i][j-1]][np[ep[i][j-1]][k]] + pc[np[ep[i][j-1]][k]][exit] ) && (pc[ep[i][j-1]][np[ep[i][j-1]][k]] == org[ep[i][j-1]][np[ep[i][j-1]][k]] ))
     ep[i][j] = np[ep[i][j-1]][k];
    I state that "np[ep[i][j-1]][k] != -1" but I do get the value -1 in the array "ep".
    Could someone tell me why I get -1 in the array?
    I hope I can finally do it all by labview not using formula node,but array like "pc[ep[i][j-1]][np[ep[i][j-1]][k]] "
    seems very hard to wire in labview. Could someone give me some good advices of doing this?
    Thanks for your help

    altenbach 已寫:
    normanshi wrote:
     ep[i][0] = pa[i];                                          (A)
     ep[i][1] = np[ep[i][0]][0];                            (B)
    ...    if ( np[ep[i][j-1]][k] != -1 && ... )          (C)
          ep[i][j] = np[ep[i][j-1]][k];                       (D)
    I state that "np[ep[i][j-1]][k] != -1" but I do get the value -1 in the array "ep".
    Could someone tell me why I get -1 in the array?
    I hope I can finally do it all by labview not using formula node,but array like "pc[ep[i][j-1]][np[ep[i][j-1]][k]] "
    seems very hard to wire in labview. Could someone give me some good advices of doing this?
    There are many possible scenarios to get a -1 in the ep output. For example if the -1 gets already written in step (A) or (B) at a certain index, and that index does not get overwritten in step (D). You are indexing all over the place! Is there some bounds checking on the array contents? What are typical inputs and array sizes?
    I'm sure about that the -1 doesn't get already written in step (A) or (B) because ep[i][0] and ep[i][1] is fine. What really makes me confuse is that sometimes ep array has the value like this.
    That means it does overwritten some value in step (D). The -1 should never be written into it because I have already state that np[ep[i][j-1]][k] != -1. Somehow I still get -1,and this is really strange! I'm indexing all over the place becuase I can't figure out a better way to achieve my requirement.
    I think I should briefly tell you what I'm trying to do. In this program,I input some values which means the distance from one point to another. Then I use floyd's all pairs shortest-path algorithm to find all the shortest distance. Finally I want to find out the "shortest path". I mean like from point 4 to point 0,the shortest path might be like 4 -> 2 -> 1 -> 0, and what the formula node part do is trying to find out this "shortest path". Maybe you can give me some better advice of doing this, I have been thinking a better way to do it for about two months. I think I'm really not good at this.
    I try to do it all by labview ,but again I get a strange problem. This time the ep[i][j-1] doesn't get the correct value. In the first time i=0 j-1=0 ep[i][j-1] = 1,but the second time i = 0 j-1 = 1 ep[i][j-1] = 0. This makes the "ep[i][j-1]!=exit" get the incorrect boolean value. The ep[i][j-1] should be 2,not 0. I try to use highlight to find if I make any mistake, but I can't one.This is the input and I put the labview program in attached file (temp4.vi).
    Could you help me find out why this happened?
    Thanks for your help altenbach!
    由 normanshi 在 08-19-2006 10:06 PM 上編輯的訊息
    Attachments:
    temp4.vi ‏191 KB
    ep.jpg ‏10 KB
    input.jpg ‏9 KB

Maybe you are looking for

  • XML IDOC post to R/3 Via WAS - want to see error content with JavaScript

    Hi, I am posting XML IDOCs to our R/3 system via a webpage that I have built with JavaScript.  I am posting to the WAS, which is configured to read the XML IDOC with SAP's standard class handler CL_HTTP_IDOC_XML_REQUEST.  We are on basis 620 support

  • Cleared Invoice should not allow to cancel.

    Dear All I have posted one invoice with reference to sales order. My finance team also cleared that invoice. Now System is allowing me to cancel the invoice document.But i dont want to allow people to cancel cleared invoice. How to achieve this. Kind

  • Document Information Dictionary Behavior

    I am seeing some strange behavior with /Author string entered into a document information dictionary. If I have a dictionary with the following entries 278 0 obj << /Author (My Company, Inc.) /CreationDate (D:20091116141414-06) >> endobj and I view i

  • Msxml6 errors while loading Premiere elements on XP SP3

    trying to install Adobe Premier elements 9 direct from DVD on my Dell Optiplex GX620 running XP SP3, install runs almost complete but stops at this error message, then rolls back install. "A network error occurred while attempting to read from the fi

  • After updating to 6.1.2 on Iphone5 can't send pictures to contacts

    After updating to 6.1.2 on Iphone5 can't send photo's to contacts . Have 1) Restored phone 2) Reset Network 3) Removed sim and replaced it to no avail. Any ideas?