Comparing Arrays of structure

2024-08-22
2024-08-23
  • gilbertamine - 2024-08-22

    Hi Everybody,

    I'm looking for a simple way of comparing two array of a structure.
    My structure is define like this :

    TYPE Positions_T :
    STRUCT
        PosX: DINT;
        PosY: DINT;
        PosZ: DINT;
    END_STRUCT
    END_TYPE
    

    I have multiples Var : ARRAY [0..220] OF Positions_T, that I need to compare quickly.
    I don't really want to do a Loop that goes by every 220 points and compare each one of them so I was wondering if there is another way.
    I came accross the MEM.Compare function, but it require to know the size in Bytes of the memory, and I don't know how to do that...

    Has anybody an idea on how to do the comparing easily ?
    Thanks in advance

     
  • gatto

    gatto - 2024-08-23

    Hi, something like this ?

     
    πŸ‘
    1
  • gilbertamine - 2024-08-23

    If I knew it was this simple...
    Exactly what I was looking for ! Thanks you very much.

     

Log in to post a comment.