Register to reply

Ordering a list in Mathematica

by HannahB
Tags: coordinates, mathematica, order
Share this thread:
HannahB
#1
Jan4-12, 08:58 AM
P: 1
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
Phys.Org News Partner Science news on Phys.org
Wildfires and other burns play bigger role in climate change, professor finds
SR Labs research to expose BadUSB next week in Vegas
New study advances 'DNA revolution,' tells butterflies' evolutionary history
CompuChip
#2
Jan4-12, 09:48 AM
Sci Advisor
HW Helper
P: 4,300
There is
Sort[list, p]
sorts using the ordering function p.
For p you could use something like
p[a_, b_] := (a[[1]] < b[[1]]) || (a[[1]] == b[[1]] && a[[2]] < b[[2]])


Register to reply

Related Discussions
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