MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Manipulating list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101550] Re: Manipulating list
  • From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
  • Date: Fri, 10 Jul 2009 06:42:32 -0400 (EDT)

Hi, Kosal,

That's what you have: 

list1 = {{A, B, C}, {D, E, F}, {G, H, II}}
list2 = {{1, 2}, {3, 4}, {5, 6}}

This gives you the list of last elements of the first list (II instead of I, since I is the imaginary unity):

In[29]:= 
Last /@ list1

Out[29]= {C, F, II}

Then this solves your problem:

In[28]:= MapThread[Append, {list2, Last /@ list1}]

Out[28]= {{1, 2, C}, {3, 4, F}, {5, 6, II}}



Have fun, Alexei





Hello Mathematica users

I am new to Mathematica and I have one particular problem I would like you to help me.
Suppose I have two lists:

    list1 = {{A,B,C},{D,E,F},{G,H,I}}
    list2 = {{1,2},{3,4},{5,6}}

I want to have the third elements in each of member list in list1 (that is, C,F,I) to appear in the first position in each member list in list2

that is, i want to have  list ={{C,1,2},{F,3,4},{I,5,6}}

 Thank you.
Kosal

-- 
Alexei Boulbitch, Dr., habil.
Senior Scientist

IEE S.A.
ZAE Weiergewan
11, rue Edmond Reuter
L-5326 Contern
Luxembourg

Phone: +352 2454 2566
Fax:   +352 2454 3566

Website: www.iee.lu

This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.




  • Prev by Date: Re: sparsearray bug?
  • Next by Date: Re: 2dFFT & image processing
  • Previous by thread: Re: Manipulating list
  • Next by thread: Selecting Rows Based on Column Values