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
Apple to unveil 'iWatch' on September 9
NASA deep-space rocket, SLS, to launch in 2018
Study examines 13,000-year-old nanodiamonds from multiple locations across three continents
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