[Purdue-pm] How to sort one dimension of a 2d array

Phillip San Miguel pmiguel at purdue.edu
Fri Jan 29 09:17:29 PST 2010


Joe Kline wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Rick Westerman wrote:
>   
>>    So if I am not missing something here,  basically you have an array
>> of arrays but then are deconstructing the data into separate arrays thus
>> destroying any relationship between the data.  That seems strange to
>> me.  But if so I'd map all of the data into their separate arrays, sort
>> those arrays and then remap that the information into your array of
>> arrays.   Or just skip that final step and deal with the separate arrays
>> since the data no longer has any relationship.
>>     
>
> Here's a perlmonks node about this:
>
> http://www.perlmonks.org/?node_id=15209
>
> joe
>   
Thanks everyone. The discussion was useful for me.
BTW, I'm not doing anything strange. Just the equivalent of  starting with:

    7   0  25  10
    0   9   7  12
    3   2   1   0

and sorting the columns:

    0   0   1   0
    3   2   7  10
    7   9  25  12

Which allows me to get max and median values for each column. (Rick, 
each row is a different trace file and each column is a scan.)

-- 
Phillip


More information about the Purdue-pm mailing list