XANSYS Message: 46745 [Go back to message list]
[bookmark on del.icio.us]
No rating yet
Rate item:

Subject: Re: [APDL] - Sorting a matrix in ascending or descending order.
Author: Bob Weathers
Date: 2003-02-13 16:33:00

I pulled this out of a macro that I wrote to sort on z coordinates.

*GET, nrNODES, NODE, , COUNT ! count how many nodes there are

*DEL, MyXYZ ! delete MyXYZ if it exists
*DIM, MyXYZ, ARRA, nrNODES, 3 ! dimension an array for X, Y, Z

*VGE, MyXYZ(1,1), NODE, , LOC, X ! get the X coordinates
*VGE, MyXYZ(1,2), NODE, , LOC, Y ! get the Y coordinates
*VGE, MyXYZ(1,3), NODE, , LOC, Z ! get the Z coordinates

*DEL, OldOrder ! delete OldOrder if it exists
*DIM, OldOrder, ARRA, nrNODES ! place to put the old order
*MOP, OldOrder(1), MyXYZ(1,3), SORT, MyXYZ(1,3) ! to sort on Z

Hope it helps. Maybe I misunderstood what you're trying to do?

Bob Weathers
trane
(608)787-2729
bweathers@t...

--- In xansys@yahoogroups.com, "Philippe Vidori "
wrote:
> Hello all,

> I would like sort, in descending order, a 8 x 3 array
> according to column 2 for example. I'd like each row to
> follow the sorting operation, as in a spreadsheet.

> *VOPER does this on a vector only and
> *MOPER only sorts on a specified vector.

> Is there something I'm missing ? Or do I need to
> start writing a little sorting macro for my
> application.

> Thanks in advance for your help,

> Philippe Vidori
> DOF Technical Services
> Blainville, QC Canada
> philvid@v...
> t.450.434.6658
> c.514.803.4805

Posts possibly associated with message #46745AuthorDateScore
46743[APDL] - Sorting a matrix in ascending or descending order.Philippe Vidori2003/02/13 
46745Re: [APDL] - Sorting a matrix in ascending or descending order.Bob Weathers2003/02/13 
46748Re: [APDL] - Sorting a matrix in ascending or descending order.Roberto Porto2003/02/13 
46750Re: [APDL] - Sorting a matrix in ascending or descending order.Philippe Vidori2003/02/13