New Reply

Ordering a list in Mathematica

 
Share Thread
Jan4-12, 08:58 AM   #1
 

Ordering a list in Mathematica


Hi everyone,

Is it possible to order a list of (x,y) coordinates in Mathematica by x, then y? I currently have a number of data files in which there are 5 columns: x, y, area, circularity, radius. I would like to order the list by x and y coordinates while keeping the rows intact.

Thank you
PhysOrg.com science news on PhysOrg.com

>> City-life changes blackbird personalities, study shows
>> Origins of 'The Hoff' crab revealed (w/ Video)
>> Older males make better fathers: Mature male beetles work harder, care less about female infidelity
Jan4-12, 09:48 AM   #2
 
Blog Entries: 6
Recognitions:
Homework Helper Homework Help
Science Advisor Science Advisor
There is
Code:
Sort[list, p]
sorts using the ordering function p.
For p you could use something like
Code:
p[a_, b_] := (a[[1]] < b[[1]]) || (a[[1]] == b[[1]] && a[[2]] < b[[2]])
New Reply

Tags
coordinates, mathematica, order

Similar discussions for: Ordering a list in Mathematica
Thread Forum Replies
Mathematica: Position of elements in a list Math & Science Software 3
Mathematica:Iteration of pairs in a list Math & Science Software 3
A list of functions in Mathematica? Math & Science Software 3
Mathematica List Plot Math & Science Software 3
Mathematica List Plot Math & Science Software 2