Parse string into array for comparison

Hi All,
I am trying to parse a string message into an array of numbers so I can check if my event was successful.
\FF\FE\01\FD\02\00\00\00
I know I just need to read through and discard the \, but I don't know how to do that in Labview. I just need to check if the 6th byte = 00 or not.
Thanks! I mostly need help with parsing in labview.

Assuming this is a plain ASCII string containing the letters 0..F and "\" as delimiter, you can simply used "Spreadsheet string to array" with the following settings:
Type= 1D U8 array
format= %x
delimiter= "\"
One problem is the extra delimiter at the beginning, so use array subset to skip the first element.
(EDIT: Ahh, Darin beat me with a similar solution. Mine's a little easier ).
Message Edited by altenbach on 08-06-2009 04:30 PM
LabVIEW Champion . Do more with less code and in less time .
Attachments:
StringToArray.png ‏13 KB

Similar Messages

  • How can i store values from my String into Array

    Hi guys
    i wants to store all the values from my string into an array,,,, after converting them into intergers,,,, how i can do this becs i have a peice of code which just give me a value of a character at time,,,,charat(2)...BUT i want to the values from String to store in an Array
    here is my peice of code which i m using for 1 char at time
    int[] ExampleArray2 = new int[24];
    String tempci = "Battle of Midway";
    for(int i=0;i>=tempci.length();i++)
    int ascii = tempci.charAt(i); //Get ascii value for the first character.

    public class d1
         public static final void main( String args[] )
              int[] ExampleArray2 = new int[24];
              String tempci = "Battle of Midway";
              for(int i=0;i<tempci.length();i++)
                   int ascii = tempci.charAt(i);
                   ExampleArray2=ascii;
              for(int i=0;i<ExampleArray2.length;i++)
                   System.out.println(ExampleArray2[i]);

  • Splitting and type casting huge string into arrays

    Hello,
    I'm developing an application which is supposed to read measurement files. Files contain I16 and SGL data which is type casted into string. I16 data is data from analog input and SGL is from CAN-bus data in channel form. CAN and analog data is recorded using same scan rate.
    For example, if we have 6 analog channels and 2 CAN channels string will be (A represents analog and C represents CAN):
    A1 A2 A3 A4 A5 A6 C1 C2 A1 A2 A3 A4 A5 A6 C1 C2 A1 A2 .... and so on
    Anyway, I have problems reading this data fast enough into arrays. Most obvious solution to me was to use shift registers and split string in for loop. I created a for loop with two inner for loops. Number of scans to read from string is wired to N terminal of the outermost loop. Shift register is initialized with string read from file.
    First of the inner loops reads analog input data. Number of analog channels is wired to its N terminal. It's using split string to read 2 bytes at a time and then type casts data to I16. Rest of the string is wired to shift register. When every I16 channel from scan is read, rest of the string is passed to shift register of the second for loop.
    Second loop is for reading CAN channels. It's similar to first loop except data is read 4 bytes at a time and type casted to SGL. When every CAN channel from scan is read, rest of the string is passed to shift register of the outermost loop. Outputs of type cast functions are tunneled out of loops to produce 2D arrays.
    This way reading about 500 KB of data can take for example tens of seconds depending on PC and number of channels. That's way too long as we want to read several megabytes at a time.
    I created also an example with one inner loop and all data is type casted to I16. That is extremely fast when compared to two inner loops!
    Then I also made a test with two inner loops where I replaced shift register and split string with string subset. That's also faster than two inner loops + shift register, but still not fast enough. Any improvement ideas are highly appreciated. Shift register example attached (LV 7.1)
    Thanks in advance,
    Jakke Palonen
    Attachments:
    String to I16 and SGL arrays.vi ‏39 KB

    OK, there is clearly room for improvement. I did some timing and my two above suggestions are already about 100x faster than yours. A few teeaks led to a version that is now over 500x faster than the original code.
    A few timings on my rather slow computer (1GHz PIII Laptop) are shown on the front panel. For example with 10000 scans (~160kB data as 6+2) my new fastest version (Reshape II) takes 14 ms versus the original 7200ms! It can do 100000 scans (1.6MB data) in under 200 ms and 1000000 scans (15MB data) in under 2 seconds.
    I am sure the code could be further improved. I recommend the Reshape II algoritm. It is fastest and can deal with variable channel counts. Modify as needed.
    Attached is a LabVIEW 7.1 version of the benchmarking code, containing all algorithms. I have verified that all algorithms produce the same result (with the limitation that the cluster version only works for 6*I16+2*SGL data, of course). Remember that the reshape function is extremely efficient, because it does not move the data in memory. I have some ideas for further improvements, but this should get you going.
    Message Edited by altenbach on 08-05-2005 03:06 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    StringI16SGLCastingTimer.png ‏48 KB
    StringtoI16andSGLArraysMODTimer.vi ‏120 KB

  • DAQ to array for comparison

    I had a previous post help with with some other issue but since running in production I realized I must change the program entirely. I have a DAQ collecting on all 8 channels. I am collecting 1 sample a second for 5 minutes. I then need to do some comparison on these values. Take the high from channel 0 and then compare to the high from channel 1 then do some math, and do the same things for 2+3, 4+5 and so on. I have been trying for quite some times to figure out how to write the daq data into an array and use the information that way but I can't nail it down. I have tried all sorts of searches and haven't found my solution. Currently I have a 5min timed loop with a for loop inside and shift registers building an array but cannot figure out how to connect them properly. Any help would be greatly appreciated.

    Hi again icemaker
    So you are trying to build an array from the values you acquire one and one? In that case here is one example (just illustrates the insert into array):
    You could also use the Collector Express VI.
    Best Regards
    David
    NISW

  • Set of string into array or a table....

    Hi Experts,
    I am using Oracle 10G, where I need to accomplish a task...
    I am getting a set of string of the sort
    "|session_id~q_id~q_key~rt_id~rt_key~request_type~field_id|session_id~q_id~q_key~rt_id~rt_key~request_type~field_id| ....."
    Here, as you can see every set which has 7 values is delimited by a "| (pipe)" and every value is delimited by a "~" ...
    I need to insert all these into a generic table and before doing that I need to split it into individual values where every set which has 7 values will get into 7 columns in a row...
    Can anyone help me out with a proper logic as to how do i go about accomplishing the same...???

    Hi,
    You have to use regular expression to tokenize string in fragments.
    This is sample for determining CRLF in a string:
    -- Tokenize rows
    FOR token IN ( SELECT REGEXP_REPLACE(REGEXP_SUBSTR(XMLCDATA('custom_string') || Chr(10), '(.*' || Chr(10) || ')', 1, LEVEL ), Chr(10), '') t
    FROM dual
    CONNECT BY REGEXP_INSTR('custom_string'||Chr(10), '(.*'||Chr(10)||')',1, LEVEL ) > 0) LOOP
    token.t --> single fragment
    END LOOP;
    Bear in mind that this forum is for Data Modeler product related issues, feedback etc. So before posting question search for appropriate forum. It's quite possible that you won't get answer while in wrong forum.
    Regards
    Edited by: Dimitar Slavov on Apr 15, 2011 2:11 AM

  • String into array in oracle

    Hi,
    I have value in a column in oracle table as "DE","DS","KJ".
    now,How can I get them into string array?
    Is there any API to get this ..
    Thanks
    Chat

    I have value in a column in oracle table as "DE","DS","KJ".
    now,How can I get them into string array?Do you mean that you have a single string with quotes and commas? If so you have to parse it to extract the constituent strings. Ostermiller has a library that does this sort of thing (Google ostermiller csv) and deals with the complexity of commas and quotes within the quoted parts.
    (If you know the string value consists of quoted section separated by commas, and there is no possibility of spaces getting in the way, you could split the string based on "," and then take substrings to remove the quotes.)
    You should pick one thread for this and stick to it. Put a message in the other linking to the thread you want to use.

  • Parse string into different column and optimization

    We are in process of building an audit process for any changes that occur automatically or manually by the user on some of the table data. To do this we have two options:
    1. Have master table to store the audit event summary and a detail table to store each column change with old and new values. Something like:
    CREATE TABLE TEST_ADT_DTL
      EVNT_ID      NUMBER,
      COL_NAME     VARCHAR2(1000),
      OLD_COL_VAL     VARCHAR2(1000),
      NEW_COL_VAL     VARCHAR2(1000)
    );but this approach has some processing overhead since for the changes to each record there will be multiple records based on number of columns updated. If we are loading 40K transaction twice a month, and the changes are almost 30-40% so the detail table will grow considerably.
    2. To have the detail table with one column that will have a concatenated string of changes with field name, old and new values.
    CREATE TABLE TEST_ADT_EVNT
      EVNT_ID        NUMBER,
      TBL_NAME       VARCHAR2(100),
      OPER_CD        VARCHAR2(1),
      USR_ID         VARCHAR2(10),
      ACT_DT         DATE,
      PK_STRNG_VAL   VARCHAR2(100),
      CMNT_TXT       VARCHAR2(1000) 
    CREATE TABLE TEST_ADT_DTL
      EVNT_ID      NUMBER,
      ADT_LOG     VARCHAR2(1000)
    INSERT INTO TEST_ADT_EVNT VALUES (1, 'CUSTOMER', 'A', 'ABC', SYSDATE, 'CUS0001', 'SOME COMMENT');
    INSERT INTO TEST_ADT_EVNT VALUES (2, 'CUSTOMER', 'U', 'ABC', SYSDATE, 'CUS0001', 'SOME COMMENT');
    INSERT INTO TEST_ADT_EVNT VALUES (3, 'ORDER', 'A', 'XYZ', SYSDATE, 'CUS0002', 'SOME COMMENT');
    INSERT INTO TEST_ADT_EVNT VALUES (4, 'ORDER', 'U', 'EFG', SYSDATE, 'CUS0002', 'SOME COMMENT');
    INSERT INTO TEST_ADT_EVNT VALUES (5, 'ORDER', 'U', 'XYZ', SYSDATE, 'CUS0002', 'SOME COMMENT');
    INSERT INTO TEST_ADT_DTL VALUES (2, 'FIELD:CITY,OLD:AVENEL,NEW:EDISON;FIELD:ZIP,OLD:07001,NEW:07056;');
    INSERT INTO TEST_ADT_DTL VALUES (4, 'FIELD:ADDRESS,OLD:234 ROGER ST,NEW:124 WEST FIELD AVE;FIELD:STATE,OLD:NJ,NEW:NY;FIELD:PHONE,OLD:,NEW:2012230912;');
    INSERT INTO TEST_ADT_DTL VALUES (5, 'FIELD:MID_NAME,OLD:,NEW:JASON;FIELD:ADDRESS,OLD:,NEW:3 COURT CT;');
    COMMIT;I want to know if we want to generate a report for audit log, how can I display the data from detail table in columns. I mean how to parse the ADT_LOG column to show the data in three different columns like:
    FIELD     OLD         NEW
    CITY     AVENEL    EDISON
    ZIP       07001      07056
    .along with the columns from EVNT table.
    And, want to know which approach would be better.

    hey I think I finally got it using the model clause.
    not sure if this will be faster or not.
    you can increase the number of iterations if you are not hitting them all,
    ( the lower your iteration number the faster this will run)
    select adt_log, field, old, new from
    with TEST_ADT_DTL as
    (select 2 evnt_id, 'FIELD:CITY,OLD:AVENEL,NEW:EDISON;FIELD:ZIP,OLD:07001,NEW:07056;' ADT_LOG FROM DUAL UNION
    select 4, 'FIELD:ADDRESS,OLD:234 ROGER ST,NEW:124 WEST FIELD AVE;FIELD:STATE,OLD:NJ,NEW:NY;FIELD:PHONE,OLD:,NEW:2012230912;' from dual union
    select 5, 'FIELD:MID_NAME,OLD:,NEW:JASON;FIELD:ADDRESS,OLD:,NEW:3 COURT CT;' from dual
    select evnt_id, adt_log, field, old, new  from test_adt_dtl
    model return updated rows
    partition by (evnt_id)
    dimension by ( 0 d)
    measures (adt_log, adt_log field, adt_log old, adt_log new, 0 it_num )
    rules iterate (50) -- until ?
    adt_log[any] = adt_log[0],
    field[0] = substr(adt_log[0], instr(adt_log[0],'FIELD',1,1)+6, instr(adt_log[0],',',1,1) - instr(adt_log[0],'FIELD',1,1)-6),
    old[0] =   substr(adt_log[0], instr(adt_log[0],'OLD',1,1)+4, instr(adt_log[0],',',1,2) - instr(adt_log[0],'OLD',1,1)-4),
    new[0] =   substr(adt_log[0], instr(adt_log[0],'NEW',1,1)+4, instr(adt_log[0],';',1,1) - instr(adt_log[0],'NEW',1,1)-4),
    field[iteration_number ] =    substr(adt_log[0],
                                         instr(adt_log[0],'FIELD:',1,iteration_number + 1 ) + 6,
                                         (instr(adt_log[0],',',( instr(adt_log[0],'FIELD:',1,iteration_number + 1 ) + 6 ),1)
                                         (  instr(adt_log[0],'FIELD:',1,iteration_number + 1 ) + 6))
    old[iteration_number ] =    substr(adt_log[0],
                                         instr(adt_log[0],'OLD:',1,iteration_number + 1 ) + 4,
                                         (instr(adt_log[0],',',( instr(adt_log[0],'OLD:',1,iteration_number + 1 ) + 4 ),1)
                                         (  instr(adt_log[0],'OLD:',1,iteration_number + 1 ) + 4))
    new[iteration_number]  =    substr(adt_log[0],
                                         instr(adt_log[0],'NEW:',1,iteration_number + 1 ) + 4,
                                           (instr(adt_log[0],';',1,iteration_number + 1)
                                           (instr(adt_log[0],'NEW:',1,iteration_number + 1 ) + 4)
    order by evnt_id, it_num
    where new is not nullEdited by: pollywog on Apr 13, 2010 10:28 AM

  • How to parse String into a char?

    Hi all,
    I have a String variable:
    String s="%28";
    However, the actual value I would like to get is indeed a character '%28', i.e. '(' . How can I change this String to the char I want?
    Thanks a lot for your help.

    remove the %
    and use:char c = (char) Integer.parseInt("28", 16);

  • Select Multiple into array for data insertion

    I have a form that contains a menu/list that allows multiple selections. The list is bound to a dynamic source with label = to a name and value = to the names record ID. The code DW CS4 generates is:
    <select name="vVol_id" size="20" multiple="MULTIPLE" id="vVol_id">
    <?php
    do { ?>
                    <option value="<?php echo $row_rsGetStaff['vol_id']?>"><?php echo $row_rsGetStaff['full_name']?></option>
                    <?php
    } while ($row_rsGetStaff = mysql_fetch_assoc($rsGetStaff));
      $rows = mysql_num_rows($rsGetStaff);
      if($rows > 0) {
          mysql_data_seek($rsGetStaff, 0);
          $row_rsGetStaff = mysql_fetch_assoc($rsGetStaff);
    ?>
    </select>
    What additional code do I need to get the selected items into an array that can be 'foreach'd' to insert the selections into another table when the submit button is clicked? This one has been driving me nuts.

    You just need the square brackets, something like: <select name="vVol_id[]"
    vVol_id will then be an array if items are selected.
    Ed

  • Parsing XML into Array problem

    my previous problem had turned slightly into a different
    issue;
    basically now when i trace the variables i'm getting
    undefined. Any help is great appreciated. Thanks!

    >>description
    = award.secondChild.nodeValue
    there is no such thing as secondChild.
    >>image = new Array(images.length);
    Where is image defined initially? You can't just use an index
    like that if
    image isn't already an array.
    I would suggest changing the structure a little. An array of
    award objects
    might work well.
    var allAwards = new Array();
    var award = new Object();
    award.caption = "my caption";
    award.images = new Array();
    allAwards.push(award);
    Then you can do like:
    trace(allAwards[0].caption);
    Dave -
    www.offroadfire.com
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Req help in conversion of string to array of args

    Hi,
    i need help in converting a string into array of args just like command line args
    i have a string s1 = 12 13 56 etc
    now i want to copy that into an array a[]
    a[0] = 12
    a[1] = 13 etc
    Thanks for help

    U can use String tokenizer.Why prefer that over split?Yah Bobby u can use split too..
    J2SE 1.4 added the split() method to simplify the task of breaking a string into substrings, or tokens.
    Thanks BigDaddy.. I realized after you told.
    try this too..
    String str = "Your string";
    String[] arr = str.split (" ");
    for (int i=0; i < arr.length; i++)
    System.out.println (arr);

  • How to record sound into array using DAQ ?

    Hi to everyone
    Im last year student , im using LABVIEW for the first time.
    i have an myDAQ , i need to record audio go through the analog ports/AUDIO INPUT of the myDAQ, into array, for later singal proccesing.
    its for my final project.

    First, Learn to use LabVIEW with myDAQ is a series of videos.  To quote the Introduction,
    The Learn to LabVIEW with MyDAQ provides fundamental LabVIEW knowledge for a great out of the box experience with your MyDAQ. Each unit provides a set of videos to allow you to learn at your own pace and review material an unlimited number of times. As well, most videos are accompanied by minor exercises which will help drive home important topics and challenge you along the way.
    View the videos, do the exercises, and I suspect many of your questions will be answered.  If you write some LabVIEW code and have a problem, come back, show us your code, and explain the problem.
    Bob Schor

  • Convert text box string into integer

    i have an html file in which i m using a text box , for entering amount i m using that text box entry at next jsp. i want to convert amount string into integer for further processing. At next jsp i m using:-
    String amount= request.getParameter("bal");
    int ammount1= Integer.parseInt(ammount);
    and in sql query i m using amount1 as:-
    ResultSet rs1 = st.executeQuery("update saving set balance = balance - amount1 where saving.account_no = '" + acc +"'");
    my problem is i m getting following error:-
    server encountered an internal error and
    exception:- numberformat exception
    please help me as soon as possible

    int ammount1= Integer.parseInt(ammount).toString();
    good to put try block too..
    try
    int ammount1 = Integer.parseInt(ammount).toString();
    catch(NumberFormatException e)
    ...}

  • Would like some help converting an array of strings into multiple parsed string arrays

    Hello everyone.
    this is a very novice question and I sincerely apologize for that, but i need some direction!
    i have an array of strings:
    (('J01',), ('0', '0', '0', '1'))
    (('J02',), ('0', '1', '0', '1'))
    (('J03',), ('0', '0', '0', '0'))
    ect...
    i would like to know what are some of the best ways to gain access to this information (aka, parse it). The field lengths are not static and all those ones and zeros could very possibly be two digits at times (0 = off state, 1-100 = on state), so simply pulling characters out of a given position of the string will not always work.
    what i would like to achieve is to make either separate arrays for each desirable element, eg:
    array one:
    J01
    J02
    J03
    array two:
    0
    0
    0
    array three:
    0
    1
    0
    and so on.
    or maybe even a matrix (if that’s feasible).
    other than that I am totally up for suggestions!!
    thank you very much,
    Grant.

    Assuming fixed structure (not necessarily length of the different numbers or names).

  • Is there an easy way to convert a long string into an array?

    I can convert a long string into a 1-d array by parsing and using build array, but I would like to know if there is a function to make this easier.
    For example:
    from/   aaaaaaaabbbbbbbbccccccccdddddddd         (string of ascii)
    to/       an array that is 1-d with each element having eight characters
              aaaaaaaa
              bbbbbbbb
              cccccccc
              dddddddd
    Thank you.
    Solved!
    Go to Solution.

    Try something like this:
    (If you can guarantee that the string length is an integer multiple of 8, you an drop the two triangular modes in the upper left. )
    Message Edited by altenbach on 03-14-2010 06:40 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ChopString.png ‏9 KB

Maybe you are looking for