Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #6849 > unrolled thread
| Started by | Ulrich Arndt <ulrich.arndt@data2knowledge.de> |
|---|---|
| First post | 2011-11-30 12:05 +0000 |
| Last post | 2011-11-30 12:05 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: How to sort elements from a two-dimensional list Ulrich Arndt <ulrich.arndt@data2knowledge.de> - 2011-11-30 12:05 +0000
| From | Ulrich Arndt <ulrich.arndt@data2knowledge.de> |
|---|---|
| Date | 2011-11-30 12:05 +0000 |
| Subject | Re: How to sort elements from a two-dimensional list |
| Message-ID | <jb566d$jda$1@smc.vnet.net> |
Do you want to distinguish 1 and 1. ?
If NOT this should do.
sort = Sort[data, First[#1] < First[#2] &]
Map[{#[[1, 1]], #[[All, 2]]} &, Split[sort, First[#1] == First[#2] &]]
or
Map[{#[[1, 1]], #[[All, 2]]} &, SplitBy[N[sort], First]]
if you want to distinguish x and x.
this should do
sort = Sort[data, First[#1] === First[#2] &]
Map[{#[[1, 1]], #[[All, 2]]} &,
Split[sort, First[#1] === First[#2] &]]
Ulrich
Am 30.11.2011 um 09:22 schrieb Pippo:
> data={{1,0.0000317057}, {1,0.0000156821}, {1,0},{1, 00000234685},{1,0.000025413}, {1., 0.0000249271},{1, 0.0000210391}, {1.,0.0000181187},{1,0.0000210391},{2, 0.000025413}, {2.,0.000024441},{2,0.0000224955}, {2,0.0000239548}, {2,0.0000234685},{2,0.0000215261},{2,0.0000132381},{2,0.0000346042},{2,0.0000336413},{3,0.0000355749}, {3,0.0000302568},{3,0.0000297722},{3, 0.000025413}, {3,0.0000239548},{3,0.0000268658}, {3,0.0000239548}, {3,0.0000273512}, {3., 0.0000273512}, {3., 0.0000142161}, {4,0.0000190941}};
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web