Re: Map
- To: mathgroup at smc.vnet.net
- Subject: [mg29708] Re: Map
- From: "Orestis Vantzos" <atelesforos at hotmail.com>
- Date: Wed, 4 Jul 2001 03:08:32 -0400 (EDT)
- Organization: National Technical University of Athens, Greece
- References: <9hs1bt$bsd$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
instead f If[...blablabla...]& /@a use Map[If[...blablabla...]&,a,{2}] f/@a maps f to the 1st layer of a ONLY. You want to map to the 2nd level of the matrix (the 1st being the rows). Orestis <bbongiorno at attglobal.net> wrote in message news:9hs1bt$bsd$1 at smc.vnet.net... > I have not been successful in converting the following If Do routine, > to a routine using the If Map function. > > Matrix > a={{1,5,10},{25,0,2000},{55,5,2001}} > > If Do Routine that works > y=0; > Do[y=y+1;x=0; > Do[x=x+1; > a[[x,y]]= > If[a[[x,y]]<10,(StringJoin[ToString[0],ToString[a[[x,y]]]]),a[[x,y]]], > {Length[a]}], > {Length[Transpose[a]]}] > > If Map Routine that does not work > > If[# < 10, (StringJoin[ToString[0], ToString[#]]), # ] & /@ a > > Please help. > Thanks, > > Benedetto Bongiorno > >