Re: ordering a large matrix and referring to the named rows later
- To: mathgroup at smc.vnet.net
- Subject: [mg75411] Re: ordering a large matrix and referring to the named rows later
- From: SzH <szhorvat-nospamplease at gmail.com>
- Date: Sat, 28 Apr 2007 06:04:22 -0400 (EDT)
- Organization: University of Bergen
- References: <f0n8n0$s99$1@smc.vnet.net>
newbie wrote:
> Hi,
> I have a large matrix {5165, 26}, the first row and first 8 columns
> identify the values in the matrix. I need to be able to sort the data
> without losing the ability to reference the labels. Any ideas?
> Thank you very much for any help!
>
>
I am not sure I understand you question correctly, but I hope this helps:
You have a list of lists, so you need a comparison function that works
with lists as arguments. E.g. to use the 9th column as a key for
sorting, try
Sort[data, #1[[9]] < #2[[9]] & ]
Szabolcs