Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #9006
| From | Sly Pandemia <slypandemia@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Map onto a column |
| Date | 2012-03-13 08:04 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jjmv20$cfr$1@smc.vnet.net> (permalink) |
Is there a neat way to map a function onto a specific column in an
array?
For example if I have
a = {{1,2,3},{4,5,6},{7,8,9}}
and I want to map f onto the second element in each row. I would
normally use
b = Map[MapAt[f,#,2]&,a]
but this seems a bit awkward. I would expect to be able to use
b = MapAt[f,a,{All,2}]
but this appears to be illegal syntax.
Is there any way to do what I want with a single Map/MapAt function?
Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread
Map onto a column Sly Pandemia <slypandemia@gmail.com> - 2012-03-13 08:04 +0000 Re: Map onto a column Ray Koopman <koopman@sfu.ca> - 2012-03-14 05:45 +0000 Re: Map onto a column JasonE <ebaughjason@gmail.com> - 2012-03-14 05:47 +0000 Re: Map onto a column roby <roby.nowak@gmail.com> - 2012-03-14 05:48 +0000 Re: Map onto a column dr DanW <dmaxwarren@gmail.com> - 2012-03-16 11:35 +0000
csiph-web