2D array , data move from a column to another column

mghosh79
2011-03-08
2011-03-23
  • mghosh79 - 2011-03-08

    I am trying to move data from one column of a 2D array to another column or one row to another row of the same array. Is there a way to perform this in one shot ? I am trying to avoid a FOR loop.

    For example
    Move Data from Column 4 to Column 3 in the Array[1..10,1..60]

     
  • Uwe - 2011-03-10

    I think you declare your array like
    myArray : ARRAY[1..10, 1..60] OF WORD;

    but if you declare your array as
    myArray : ARRAY[1..10] OF ARRAY[1..60] OF WORD;

    then you have a 2D array too.
    In this case you have access for a cell with
    myArray[1][7]

    and for a column with
    myArray[1]

    so you can write for copy column 4 to column 3
    myArray[3] := myArray[4];

     
    πŸ‘
    1

    Related

    Talk.ru: 1
    Talk.ru: 3
    Talk.ru: 7

  • mghosh79 - 2011-03-23

    Thank you !

    I tried the " SysMemMove " and was able to move blocks of data . But , your method is easier

    PArray : ARRAY[1..4];

    SysMemMove(pDest := ADR(PArray) + SIZEOF(PArray[1]), pSrc := ADR(PArray) , udiCount := SIZEOF(PArray)- SIZEOF(PArray[1]));

     

    Related

    Talk.ru: 1


Log in to post a comment.