How to compare 1D array

I am reading data from inport in hex form and save it in array to compare data with 0100800000D0..  how can i make hex constant array to store 010080000D0... and then compare it with the array that store data from inport.. (Actually it works as check)
Or there is any other good option
timmy
Solved!
Go to Solution.

indo asia wrote:
I am receving data in single byte like 00, 01 or 08.... But my check is 5byte thats why first i store my data in array and than want it to compare. On comparing if its true than i have to send data..
The string diagram constant on your diagram is 10 bytes, not five. Try hex display instead before entering.
Do you (1) stream until five consecutive bytes match the desired pattern, or do you (2) read exactly five bytes, then compare with the constant? In case (2), the outer while loop should probably be a FOR loop. Autoindex at the output tunnel and you get an array with five elements.
What is the purpose of the inner while loop. Should it have a small wait?
You get an I8 value, so doing a logical AND with xFF in the inner loop does not do anything useful. Right?
What's up with all these sequence structures? None are needed. Use the error wire to enforce execution order instead.
You can use "stop if true" so you don't need to invert the boolean.
You forgot to include the subVI. Please attach it.
Here's a quick draft (case 2 above) to get you some ideas. More code is needed to make a complete program, e.g. the inner loop will run forever if there is a problem. Not good.
LabVIEW Champion . Do more with less code and in less time .
Attachments:
Compare5Bytes.png ‏8 KB

Similar Messages

  • How to compare 2 arrays with different operator options using parameters in Teststand

    Pls let me know how to compare 2 arrays using different operators like <= or >= or ==......

     I am using TS 2010. FYI
    ex:
    Array XX [ A_Temp,
                   B_Temp,
                   C_Oil Pressure,
                   D_Oilpressure,
    Note : A_Temp, B_Temp,C_Oil Pressure,D_Oilpressure all these parameters will be getting  numerical values (dynamically) from the simulink models and also in future I may need to add parameters to this array.
    Array YY [A_Temp_1,
                   B_Temp_2,
                   C_Oil Pressure_3,
                   D_Oilpressure_4,
    Note : A_Temp_1, B_Temp_2,C_Oil Pressure_3,D_Oilpressure_4 all these parameters will be getting  numerical values (dynamically) from the simulink models
    So my question :
    I would like to verify A_Temp >= A_Temp_1
                                B_Temp >= B_Temp_2
                                C_Oil Pressure  >= C_Oil Pressure_3  etc

  • How to compare consecutive groups of numbers in arrays

    Hi
    I require to place the solution into a 1D array.
    I need to compare two arrays and save the same numbers that are in both arrays but also save groups of numbers that may be in only one of the two arrays being compared.
    In the example l have not been able to place all consecutive groups of numbers 8,9,10,11,12 into a 1D array.
    In the example l need to filter out the zeros and the number four.
    The numbers in both arrays are always in descending order however may not be in the order of index number of array. That is 15 = 15 index number
    A consecutive group of numbers in this example is a group that increase by a value of 1. E.g.. 8,9,0,22,23,24 are two consecutive groups of numbers.
    Thank  you
    Solved!
    Go to Solution.
    Attachments:
    Compare numbers and consecutive numbers in arrays.vi ‏17 KB

    Hi Lynn
    I did have a look at the consecutive array solution. I have looked and looked l thought l knew how it worked but after a number of separate evaluations with other code l have failed. I am just glad it works. With the consecutive array solution l tried today my own code but l lost either the first number of the last number of a consecutive group of numbers.
    I may have confused you but in doing so you have provided a real different view which l am very grateful. You have viewed the consecutive number problem as just a single 1D array problem. By doing this you have opened my eyes to another way to do the job and a way to handle this type of data. However l am also comparing two arrays. For example l have to pick up say two equal values in two columns that the consecutive array does not detect and then correctly locate a value in the final array if the value is not in the final array.
    What l have not told you is also l have to be able to identify groups of numbers in two 1D arrays. E.g... Array 1 has 1,2,9,10 next array has 9,10 the final array ends up 9,10 when l would like 0,9,10. When viewing numbers by rows later on l can then detect with a array length vi the length of the 1,2 groups of numbers over a large number of columns. If 9,10 jumps to the front it becomes a wrong length. This is actually my main problem which has caused me a large amount of extra programming. I have gone back to basics to see what l can do differently and you have provided the first clue with the consecutive array. I placed it in my main program today and it filtered a lot variable data which l could not remove without losing real data. The main data lost in your solution was the say 17 number in two columns which in an image is a horizontal line. I know what l have just provided you in this paragraph is all new information but it provides a background as to what l am up to. I am getting pixel data from a 2D array and comparing +1 index 1D array with a normal array. This way l can view the data of the next column to see if there is a pattern. I am actually trying to program an array as how humans view objects in images.
    I will have another go at integrating your solution next week
    Regards
    Michael

  • How to compare the same array?

    Hello,
    The question not how to compare arrays.
    I have a method that gives results of an array type int.
    for(......){
    int [] arrayFunc(int [] input)
    return arrayOut;
    }I want to compare those arrayOut arrays. I need to find a way to save the first output and then compare it with the newest output. Where do I have to put the temp array to temporary save the array? What should happen if I want to keep track of the results and get comparisons of first, second, third output?
    Thanks

    Still not 100% sure but I try and help. What you need to do is have two references. After you have generated a result compare it to the last result. After the comparison you need to assign the current result to the last result and then go around the loop again to generate a new current result. Below is some code that uses plain ints but I hope it illustrates what I am trying to explain.
    import java.util.Scanner;
    class ComparingNumbers {
      public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int current;
        System.out.print("Number: ");
        int last = scanner.nextInt();
        scanner.nextLine();
        for(int index = 0; index < 10; index++) {
          System.out.print("Number: ");
          current = scanner.nextInt();
          scanner.nextLine();
          System.out.println("Difference is " + Math.abs(current - last));
          last = current;
    }

  • How to compare result from sql query with data writen in html input tag?

    how to compare result
    from sql query with data
    writen in html input tag?
    I need to compare
    user and password in html form
    with all user and password in database
    how to do this?
    or put the resulr from sql query
    in array
    please help me?

    Hi dejani
    first get the user name and password enter by the user
    using
    String sUsername=request.getParameter("name of the textfield");
    String sPassword=request.getParameter("name of the textfield");
    after executeQuery() statement
    int exist=0;
    while(rs.next())
    String sUserId= rs.getString("username");
    String sPass_wd= rs.getString("password");
    if(sUserId.equals(sUsername) && sPass_wd.equals(sPassword))
    exist=1;
    if(exist==1)
    out.println("user exist");
    else
    out.println("not exist");

  • How to compare two rows in PL/SQL?

    Hi All,
    How to compare two rows in PL/SQL? Is there any method that I can use instead of comparing them column by column?
    Any feedback would be highly appreciated.

    PhoenixBai wrote:
    Hi All,
    How to compare two rows in PL/SQL? Is there any method that I can use instead of comparing them column by column?What "rows" are you referring to?
    If you're talking of rows within a PL/SQL associative array there are techniques as described in the documentation... e.g.
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    type v1 is table of number;
      3    r1 v1 := v1(1,2,4);
      4    r2 v1 := v1(1,2,3);
      5  begin
      6    if r1 MULTISET EXCEPT DISTINCT r2 = v1() then
      7      dbms_output.put_line('Same');
      8    else
      9      dbms_output.put_line('Different');
    10    end if;
    11* end;
    SQL> /
    Different
    PL/SQL procedure successfully completed.
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    type v1 is table of number;
      3    r1 v1 := v1(1,2,3);
      4    r2 v1 := v1(1,2,3);
      5  begin
      6    if r1 MULTISET EXCEPT DISTINCT r2 = v1() then
      7      dbms_output.put_line('Same');
      8    else
      9      dbms_output.put_line('Different');
    10    end if;
    11* end;
    SQL> /
    Same
    PL/SQL procedure successfully completed.
    SQL>If you're talking about rows on a table then you can use the MINUS set operator to find the rows that differ between two sets of data...
    SQL> select * from emp;
         EMPNO ENAME      JOB              MGR HIREDATE                    SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-1980 00:00:00        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-1981 00:00:00       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-1981 00:00:00       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-1981 00:00:00       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-1981 00:00:00       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-1981 00:00:00       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-1981 00:00:00       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-1987 00:00:00       3000                    20
          7839 KING       PRESIDENT            17-NOV-1981 00:00:00       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-1981 00:00:00       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-1987 00:00:00       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-1981 00:00:00        950                    30
          7902 FORD       ANALYST         7566 03-DEC-1981 00:00:00       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-1982 00:00:00       1300                    10
    14 rows selected.
    SQL> select * from emp2;
         EMPNO ENAME      JOB              MGR HIREDATE                    SAL       COMM     DEPTNO
          7521 WARD       SALESMAN        7698 22-FEB-1981 00:00:00       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-1981 00:00:00       2975                    20
          7782 CLARK      MANAGER         7839 09-JUN-1981 00:00:00       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-1987 00:00:00       3000                    20
          7839 KING       PRESIDENT            17-NOV-1981 00:00:00       5000                    10
          7900 JAMES      CLERK           7698 03-DEC-1981 00:00:00        950                    30
          7934 MILLER     CLERK           7782 23-JAN-1982 00:00:00       1300                    10
    7 rows selected.
    SQL> select * from emp
      2  minus
      3  select * from emp2;
         EMPNO ENAME      JOB              MGR HIREDATE                    SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-1980 00:00:00        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-1981 00:00:00       1600        300         30
          7654 MARTIN     SALESMAN        7698 28-SEP-1981 00:00:00       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-1981 00:00:00       2850                    30
          7844 TURNER     SALESMAN        7698 08-SEP-1981 00:00:00       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-1987 00:00:00       1100                    20
          7902 FORD       ANALYST         7566 03-DEC-1981 00:00:00       3000                    20
    7 rows selected.If you actually need to know what columns data is different on "non-matching" rows (based on your primary key) then you'll have to compare column by column.

  • How to traverse an array with a for-loop in this certain way...

    so I need to traverse an array starting from the first element, then from the last element, then the second element, then the second last element, then third element and so on... in a for loop
    how would that look in code?
    Any help would be appreciated, thanks!
    Edited by: inspiredone on Apr 4, 2008 6:34 AM

    Wow, that's a really clever and elegant way to do it promethuzz. I actually came up with something already before I read your post so yeah don't worry about me copying or anything. Mine is not as elegant/efficient and I definitely like yours a lot more but I will just share it anyway...it looks pretty similar to the second algorithm The_Matrix has provided. I figured this out from thinking how quicksort compares its pivot with the two indexes...
        int front=0;
        int back = a.length - 1;
        int counter =0;
        boolean switchflag = true;
        while(front<=back)
          System.out.println(a[counter]);
          if(switchflag)
            counter = back;
            front++;
            switchflag = false;
          else
            counter = front;
            back--;
            switchflag = true;
        } Anyways, thanks a lot for you guys help, promethuzz, The_Matrix, and newark.
    Edited by: inspiredone on Apr 4, 2008 11:25 AM
    Edited by: inspiredone on Apr 4, 2008 11:27 AM

  • Compare 2 arrays,if same value add the value.If different value show 0

    hello to all! i am new to labview and i'am trying to solve a labview exercise
    ''compare 2 arrays 1d 1x10 (the values of them are lucky numbers from 1 to 10)  .compare them and create a new array [1,10] that saves the same values in the corresponding places ,while in the remainder places where the elements of 2 tables are different  show 0''
    One Example
    In this time of project i have stuck at the comparison of values of two array.and how i would achive creating the Array3! I have search the forum about founding any answer.Any ideas?
    Message Edited by sdadfsdfds on 06-05-2008 12:08 PM
    Message Edited by sdadfsdfds on 06-05-2008 12:09 PM

    I am guessing that since this is a labview exercise it is meant as a learning experience.  There are several ways to solve this problem, I have shown one way below.  I suggest that you try and come up with other ways on your own.  Feel free to ask any questions.
    Cheers
    Message Edited by jmcbee on 06-05-2008 11:25 AM
    CLA, CLED, CTD,CPI, LabVIEW Champion
    Platinum Alliance Partner
    Senior Engineer
    Using LV 2013, 2012
    Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
    Attachments:
    Compare Arrays.PNG ‏3 KB

  • How to compare an Object of type class?

    Hi,
    I got a generic array and want to check which class it contains.
    Now i tried to use
    Class c = T[0].getClass();and later
    if(c instanceof Float){
    }but this don't work.
    So how to compare two instances of Class?
    Maybe by looking for the name of the class and compare them?
    regards.
    Olek

    import java.util.*;
    public class WorksForMe {
        public static void main(String[] args) {
            List<Object> list = new ArrayList<Object>();
            list.add(Float.valueOf(17));
            Class<?> cls = list.get(0).getClass();
            System.out.println(Float.class.equals(cls)); //true
            System.out.println(Float.class == cls); //true
    }But again, it's best to avoid this kind of case analysis.

  • Compare 2 Arrays??

    Hi,
    I'm looking for a easy way to compare 2 arrays and get an result. We take one on we have in the first array the values 1, 2, 3, 4 and 5 and in the second array we have the values 3 and 5.
    array1 | array2
    1 | 3
    2 | 5
    3 |
    4 |
    5 |
    After comparing I should get as result jus the values 1,2 and 4. I already searched for a solution but i couldn't find anything. Except a way, that I think would be quite complex.
    My Solution ->
    First I read out both arrays and try to save them in a collection (HashSet) type. Then it will be possible to use the method removeAll() of the interface Set. The result should again be converted to an array.
    Does anyone know an easier way? Thx!
    Cyrill

    Why is using a Set so hard? That seems like the best way to me. The "hard" part would only be if you're filling the set with a loop instead of the easy way:
    Set set = new HashSet(Arrays.asList(yourArray));
    set.removeAll(Arrays.asList(yourOtherArray));How can it get easier than 2 lines of code?

  • How to compare two files using MD5?

    Hi,all:
    How to compare two files to know if they're the same without any difference?I want to use MD5, but I just konw how get a message digest of a string. How to get a message digest of a file? Or there is other method to compare two files?
    Thanks advance!

    This is starting to sound rather a lot like a homework problem.
    An MD5 message digest is simply a 16 byte array. To compare two message digests...
    byte[] md5incoming = ...
    byte[] md5comparison = ...
    if( md5incoming.equals(md5comparison) ) {
       System.out.println("MD5 Checksums match");
    }To find out how to generate an MD5 checksum, please look up MessageDigest in the API documentation, and do a google search for "MD5 java"
    In a networked scenario, there are two issues - firstly the performance in sending copies of files all over the place (imagine if it's a 10Gb file to be compared over a 14.4K modem link, this would take a while). Secondly, the network link itself might insert an error in the file and you'd get a false miss.
    By only sending MD5 digests over the link, you simultaneously reduce the error (shorter files are less likely to be corrupted) and reduce the transmission time (16 bytes takes practically no time to transmit over damp string, let alone any sort of sensible device).
    D.

  • Compare Two Array

    Hi,
    can you plz help me.
    How i can compare two array. following my code..
    var my_array:Array=Array(5,10,15,20,25,30)
    var new_array:Array=Array(7,8,9,10,11,12,13)
    for(var i:Number=0;i<my_array.length;i++){
        if(my_array[i]==new_array[i]){
            trace(my_array[i])
    Thanks in Advance,
    JaxNa

    hey dear can you tell me one thing..
    when my_array length is 3
    and new_array length is 5
    that time how i can compare two array actually i have this problem..
    var my_array:Array = Array(5, 10, 15, 20);
    var new_array:Array = Array(7, 8, 9, 10, 11, 12);
    for (var i:Number = 0; i<my_array.length; i++) {
         if (my_array[i] == new_array[i]) {
            trace("'My Array' "+i+"("+my_array[i]+") 'new_array' "+i+"("+new_array[i]+") = Matching");
         } else {
            trace("'My Array' "+i+"("+my_array[i]+") 'new_array' "+i+"("+new_array[i]+") = Not Matching");
    Thanks

  • How to compare the no. items in an order i ERP and CRM?

    Hi SAP Experts,
    We are facing an issue where the number of line  items in an order(same order) in ERP and CRM are different , properly not synchronized.e.g., one order in ERP is having 5 line items but in CRM for the same order has 7 line items.
    How to compare and identify the difference in number of line items in ERP and CRM for same orders?
    Is there any report or tables , any  other way?
    Thanks in advance
    Best Regards
    Succhi

    You can use transaction SDIMA for checking if data between crm and erp are synchronized. You can either run a Header comparison or Detailed comparison of the data. It is simple and easy to use. You can find more details here: http://help.sap.com/saphelp_crm70/helpdata/EN/49/2a5a1d6c7f3895e10000000a421937/frameset.htm
    Or you can use report CRM_ODE_CHECK_DOC in CRM system to compare sales Documents between R/3 and CRM per transaction type/sales organization or even the transaction number. Also has got options to check transactions Not equal in CRM and R/3.
    Regards.

  • How to compare dates in Crystal Reports 2008

    Hello,
    I cannot figure out how to compare the dates in the Crystal reports.
    I need all dates that are in the future to be displayed with the green font.
    So in the formula for the font for this texbox I've tried to use different
    formulas like:
    If DateDiff("d", CurrentDate, {DevelopmentTracking_SELECT.Anticipated}) > 1
    Then
         crGreen
    or
    If {DevelopmentTracking_SELECT.Anticipated} > CurrentDate Then
         crGreen
    (where DevelopmentTracking_SELECT is the stored procedure, and Anticipated
    is a date field).
    None of them worked. All dates are treated like they were in the past
    comparing to the CurrentDate. If I reverse these formulas like:
    If {DevelopmentTracking_SELECT.Anticipated} < CurrentDate Then
         crGreen
    then all dates turn to green, otherwise they always stay black.
    What could be a problem here?
    I would appreciate your help.
    Thank you.

    OK, got it, thank you. It worked.
    However, I also need to use another field value which is not on the report, like this:
    If CurrentFieldValue < CurrentDate And {DevelopmentTracking_SELECT.Completed} = False Then
    crRed
    DevelopmentTracking_SELECT.Completed is not on the report.
    Is it possible to use it with the cross-tab?

  • How to compare records in singe internal table

    Hi Folks,
    iam having 3 records in my first itab( T_FINAL) with fields
    material no,  descrip ,  mat type and  group.
    and 16 records in second itab(T_MVKE ) with fields
    mat no ,  distri.chanel  and division
    now I want to fetch the records from T_MVKE  by comparing the records in
    T_FINAL .my requirement is to check the given mat no. in sales org.2000,2100.  if yes then i have to consider 2000 only, if it is in only 2100 then consider 2100 only . is it is in 2000 only then consider 2100 only
    my code is
    LOOP AT T_FINAL.
        READ TABLE T_MVKE WITH KEY MATNR = T_FINAL-MATNR.
       IF SY-SUBRC = 0.
       ON CHANGE OF T_MVKE-MATNR OR T_MVKE-VKORG.
    IF T_MVKE-VKORG = '2000' and SY-TABIX > 1.
          CONCATENATE '2000' 'TS' P_WERKS T_FINAL-MATNR INTO KEY.
    ELSEIF T_MVKE-VKORG = '2000' AND SY-TABIX = 1.
         CONCATENATE '2000' 'TS' P_WERKS T_FINAL-MATNR INTO KEY.
    ELSE.
        CONCATENATE '2100' 'TS' P_WERKS T_FINAL-MATNR INTO KEY.
        ENDIF.
    this logic fails ,. could tell me how to compare values in single itab?
    Thanks
    neha

    Hi ,
    if i've understand you correctly , try that:
    LOOP AT t_final.
      AT NEW matnr.
        CLEAR: v_2000, v_2100.
    *1) 2000
        READ TABLE  t_mvke    WITH KEY matnr = t_final-matnr
                                       vkorg = 2000.
        IF sy-subrc = 0.
          v_2000 = 'X'.
        ENDIF.
    *2) 2100
        READ TABLE  t_mvke    WITH KEY matnr = t_final-matnr
                                       vkorg = 2100.
        IF sy-subrc = 0.
          v_2100 = 'X'.
        ENDIF.
    *compare
        IF v_2000 = 'X' AND  v_2100 = 'X'.
    *read 2000 only
        ELSEIF v_2000 = ' '  AND v_2100 = ' '.
    *nothing found
        ELSE.
    *all other combinations
    *read 2100 only
        ENDIF.
      ENDAT.
    ENDLOOP.
    regards Andreas

Maybe you are looking for

  • Is there a way to report a complaint about a moderator here in the Apple Support Communities?

    I spent a long time writing a question about an issue I'm having and submitted it to the OS X Mavericks section because I couldn't find an OS X Yosemite Beta section. I got a rapid response from a member of the community who I assume is a moderator o

  • 1st generation iPod apps

    I upgraded my 1st generation iPod, but when I click on iTunes app or App Store app, it says that it can not connect ..... What should I do?

  • Opt-click & drag to copy doesn't work..why???

    Hello, I am having trouble with the shortcut copy & drag command (holding down option while dragging a note event or region.) It only seems to work about half the time- frequently, it moves the event instead of moving a copy. Then I have to undo & tr

  • Tables for Balance sheet Items.

    Dear All, I want to know the tables for Balance Sheet items like Current Assets Current Liabilities etc like where the cumulative amounts of there  accounts goes ? If not so given in SAP please suggest me the procedure for How to get there amounts in

  • Dead video on Sun W2100

    I got a used Sun W2100 workstation when I power it on the fans start up and then quiets down and seem to boot normally. I have a type 6 Sun usb keyboard and the computer seems to recognize the kb; but the problem is the video I get a completely blank