Re: Converting 2D Lists to 3D lists
- To: mathgroup at smc.vnet.net
- Subject: [mg94955] Re: Converting 2D Lists to 3D lists
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Thu, 1 Jan 2009 07:24:53 -0500 (EST)
- References: <gjfjr3$d7a$1@smc.vnet.net>
Hi, Append[#,5] & /@ SampleList3D ?? Regards Jens Karthik Sridhara wrote: > Hello Everyone, > > I want to know if there is a way to convert a 2D lists to 3D Lists. > Below is the example list in list form: > > SampleList3D = {{{-1, 2}, {0, 1}, {3, 4}}, {{-3, -2}, {-1.5, 2.5}, > {0.5, -.75}}} > > I want the list to be intact but add 5 at the end of each sublist; > This is how I want it to look: > > {{{-1, 2, 5}, {0, 1, 5}, {3, 4, 5}}, {{-3, -2, 5}, {-1.5, 2.5, 5}, > {0.5, -.75, 5}}} > > I also want to be able do the same as above but add 3 this time to the > second column. This is how it should look. > {{{-1, 2, 5}, {0, 1, 5}, {3, 4, 5}}, {{-3, -2, 3}, {-1.5, 2.5, 3}, > {0.5, -.75, 3}}} > > Is there any way I can do this? I have been trying to use Map and > Insert but I am getting the wrong result. > > Insert[SampleList3d, x, {#, -1}] & /@ {1, 2} ; > > I get this result and this is not what I want: > {{{{-1, 2}, {0, 1}, {3, 4}, > x}, {{-3, -2}, {-1.5, 2.5}, {0.5, -0.75}}}, {{{-1, 2}, {0, 1}, {3, > 4}}, {{-3, -2}, {-1.5, 2.5}, {0.5, -0.75}, x}}} > > > Some help, ideas, thoughts, tips please. Thanks in advance, > Karthik Sridhara >