Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #11159
| From | awnl <awnl@gmx-topmail.de> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Data Format |
| Date | 2012-08-02 08:46 +0000 |
| Message-ID | <jvdepb$bvi$1@smc.vnet.net> (permalink) |
| References | <jvaran$751$1@smc.vnet.net> |
| Organization | Time-Warner Telecom |
Hi,
> 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?
For just this simple case I wouldn't suggest to create the symbols C1
and C2. For more complicated cases it might be a reasonable choice but
probably there are better ways to deal with this. Anyway, this will do
what I think you want:
(Set @@ {Symbol[#1], #2}) & @@@ list
it will define the symbols C1 and C2 and set their values to the
corresponding lists. @@ and @@@ are shortcuts for Apply.
hth
Albert
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Data Format "Nicholas Kormanik" <nkormanik@gmail.com> - 2012-08-01 09:02 +0000
Re: Data Format awnl <awnl@gmx-topmail.de> - 2012-08-02 08:46 +0000
Re: Data Format Ray Koopman <koopman@sfu.ca> - 2012-08-03 08:18 +0000
Re: Data Format awnl <awnl@gmx-topmail.de> - 2012-08-04 10:04 +0000
Re: Data Format Murta <rodrigomurtax@gmail.com> - 2012-08-02 08:52 +0000
csiph-web