Got intersting question today about sorting 2-dimentional arrays, but can't find an easy solution.
Logix controller
Let say we have array DINT[x,y]
First we need to sort it based on first dimention only DINT[x,0] - this can be done with one SRT instruction.
Now difficult part:
As element DINT[x,0] goes up or down within array during sort,
it needs to grab all other elements within the same line
DINT[x,1], DINT[x,2]...DINT[x,y]
and move them at the same time.
To simulate this you can use excel:
Before
[attachmentid=3253]
Sort By column A
[attachmentid=3254]
After:
[attachmentid=3255]
I can do subroutine with buble sort using FOR-NEXT loop,
but for large arrays it will take some scan time.
Any ideas?