Re: Map
- To: mathgroup at smc.vnet.net
- Subject: [mg29691] Re: [mg29684] Map
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Wed, 4 Jul 2001 03:08:18 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
You need to use level specification: In[50]:= a={{1,5,10},{25,0,2000},{55,5,2001}}; In[51]:= Map[If[# < 10, (StringJoin[ToString[0], ToString[#]]), # ] & ,a,{2}] Out[51]= {{01,05,10},{25,00,2000},{55,05,2001}} on 7/3/01 5:40 PM, bbongiorno at attglobal.net at bbongiorno at attglobal.net wrote: > 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 > > > -- Andrzej Kozlowski Toyama International University JAPAN http://platon.c.u-tokyo.ac.jp/andrzej/ http://sigma.tuins.ac.jp/~andrzej/