Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #11173 > unrolled thread
| Started by | Alexei Boulbitch <Alexei.Boulbitch@iee.lu> |
|---|---|
| First post | 2012-08-02 08:55 +0000 |
| Last post | 2012-08-02 08:55 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
Re: Data Format Alexei Boulbitch <Alexei.Boulbitch@iee.lu> - 2012-08-02 08:55 +0000
| From | Alexei Boulbitch <Alexei.Boulbitch@iee.lu> |
|---|---|
| Date | 2012-08-02 08:55 +0000 |
| Subject | Re: Data Format |
| Message-ID | <jvdf9a$c4v$1@smc.vnet.net> |
Please consider the following code, which is data imported directly into
Mathematica via a .mtp file (Minitab Portable Worksheet), and then using
list assignment:
list = {"C1" -> {5.`, 4.`, 7.`, 3.`, 6.`, 6.`, 7.`, 1.`, 5.`, 6.`}, "C2"
-> {2.`, 5.`, 6.`, 7.`, 7.`, 1.`, 5.`, 4.`, 7.`, 2.`}}
The following two commands work:
Mean["C1" /. list]
Mean["C2" /. list]
However I would prefer to be able to issue the following commands instead:
Mean[C1]
Mean[C2]
How can the code at top be converted so that these simpler commands will
work?
Thanks.
Nicholas Kormanik
Hi, Nicholas,
I cannot tell what is it for a file, .mtp, but it is quite clear what the output means and how to operate further.
The notation
"C1" -> {5.`, 4.`,.}
means that the string C1 will from now be the corresponding list. It is not what you want, I guess you need a plain list. Part[ ] will help:
list = {"C1" -> {5.`, 4.`, 7.`, 3.`, 6.`, 6.`, 7.`, 1.`, 5.`, 6.`},
"C2" -> {2.`, 5.`, 6.`, 7.`, 7.`, 1.`, 5.`, 4.`, 7.`, 2.`}};
lst1 = list[[1, 2]]
lst2 = list[[2, 2]]
lst3 = {lst1, lst2}
{5., 4., 7., 3., 6., 6., 7., 1., 5., 6.}
{2., 5., 6., 7., 7., 1., 5., 4., 7., 2.}
{{5., 4., 7., 3., 6., 6., 7., 1., 5., 6.}, {2., 5., 6., 7., 7., 1.,
5., 4., 7., 2.}}
You may now operate as usually. For example here is Mean acting on the first sublist:
Mean[lst1]
5.
If you have not done this before, have a look into Menu/Help/Part, Menu/Help/ExpressionStructure and Menu/Help/PartsOfExpressions.
Have fun, Alexei
Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG
Office phone : +352-2454-2566
Office fax: +352-2454-3566
mobile phone: +49 151 52 40 66 44
e-mail: alexei.boulbitch@iee.lu
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web