MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: ordering a large matrix and referring to the named rows later

  • To: mathgroup at smc.vnet.net
  • Subject: [mg75353] Re: ordering a large matrix and referring to the named rows later
  • From: dh <dh at metrohm.ch>
  • Date: Thu, 26 Apr 2007 03:32:13 -0400 (EDT)
  • References: <f0n8n0$s99$1@smc.vnet.net>


Hi,

please try to word you question more accurately. Do you mean that the 

first row and first 8 column contain headers? If so, you can strip them by:

Drop[mat,{1},Range[8]]

Now, we have the matrix with values. How do you want to sort them? 

Assuming we sort them according to size, we can do this by first flatten 

the value into a list. Ordering[Flatten[mat]] gives you the indices of 

the sorted values in the list. To get the row/col of the matrix from the 

list index, say i1, assuming the matrix has cols columns:

  {1+Quotient[i1-1,cols],1+Mod[i1-1,cols]}

hope this helps, Daniel



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!

> 

> 




  • Prev by Date: Re: Re: Re: strange behavior of Integrate
  • Next by Date: Re: Sometimes <space> means multiple , sometimes not
  • Previous by thread: Re: ordering a large matrix and referring to the named rows later
  • Next by thread: Re: ordering a large matrix and referring to the named rows later