Map onto a column
- To: mathgroup at smc.vnet.net
- Subject: [mg125412] Map onto a column
- From: Sly Pandemia <slypandemia at gmail.com>
- Date: Tue, 13 Mar 2012 03:02:42 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
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?
- Follow-Ups:
- Re: Map onto a column
- From: Thomas Dowling <thomasgdowling@gmail.com>
- Re: Map onto a column
- From: Bob Hanlon <hanlonr357@gmail.com>
- Re: Map onto a column
- From: Sseziwa Mukasa <mukasa@gmail.com>
- Re: Map onto a column