|
[Date Index]
[Thread Index]
[Author Index]
Re: sort and positon matrix element help
- To: mathgroup at smc.vnet.net
- Subject: [mg73077] Re: [mg73050] sort and positon matrix element help
- From: Sseziwa Mukasa <mukasa at jeol.com>
- Date: Thu, 1 Feb 2007 03:39:22 -0500 (EST)
- References: <200701310512.AAA15216@smc.vnet.net>
On Jan 31, 2007, at 12:12 AM, comp.soft-sys.math.mathematica wrote:
> Hi, guys,
>
> I am attacking one proble and may need your help.
> I have a large matrix(m*n). I wanna to sort out the matrix
> from large to small according to its element's value AND save the
> corresponding row and column number as its position. Latter on, plot
> out the first 20 largest value accroding to their positions.
> Is there any good way to do this, especially take out the
> positons of element and assocate it with the value?
You can get the largest 20 elements of the array with Ordering[Flatten
[array],-20].
Position[array,Union[Ordering[Flatten[array],-20]] will get you the
positions of those elements including possible duplicates.
If your array is large but you only care about 20 elements, you can
cut down your storage requirements by not storing the sorted array or
appending position information for all the elements.
Regards,
Ssezi
Prev by Date:
Re: Remote Kernel does nothing
Next by Date:
Re: Re: How to do quickest
Previous by thread:
Re: sort and positon matrix element help
Next by thread:
Re: sort and positon matrix element help
|