Re: Table extraction

*To*: mathgroup at smc.vnet.net*Subject*: [mg19236] Re: Table extraction*From*: "Lars Hohmuth" <larsh at wolfram.com>*Date*: Wed, 11 Aug 1999 02:06:50 -0400*Organization*: Wolfram Research, Inc.*References*: <7odkbs$7mq@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

If you happen to be using Mathematica 4, you can use All to select columns. In[7]:= tab1 = {{a, b, c}, {d, e, f}, {g, h, i}}; In[8]:= tab1[[All, 1]] (*selects the first column*) Out[8]= {a, d, g} In[9]:= tab1[[1]] == tab1[[1, All]] (*[[1]] and [[1,All]] both select the first row*) Out[9]= True In[10]:= tab1[[{1, 2}, {1, 2}]] (*selecting a submatrix*) Out[10]= {{a, b}, {d, e}} In[11]:= tab1[[{1, 3}, {2, 3}]] (*selecting elements 2 and 3 of rows 1 and 3*) Out[11]= {{b, c}, {h, i}} Lars Hohmuth Wolfram Research, Inc. Maurice Shevalier <maurice at phas.ucalgary.ca> wrote in message news:7odkbs$7mq at smc.vnet.net... > Hi, > > I am trying to extract a section of a table with not much luck.... > > I have defined two tables (actually two arrays which are used to plot > vectors with ListPlotVectorField) as follows: > > xyvector = Table[{0.,0.},{j,1,64},{i,1,320}]; > backvector = Table[{0.,0.},{j,1,16},{i,1,100}]; > > I need to extract part of xyvector and place it into backvector. I have > tried to use Part. I can extract the j range correctly (rows), but I > can't get the Part function to extract in the i range (columns). > > I tried using Part[xyvector,{2,3}] which extracts 2 rows but I cannot > figute out how to extract the necessary columns > > Can anyone help? > > Thanks, > > Maurice > > -- > Maurice Shevalier | .~. > Ph.D. Candidate | /V\ L I N U X > Dept. of Physics and Astronomy | // \\ >The Penguin, The Slayer?< > University of Calgary | /( )\ > Calgary, AB, CANADA T2N-1N4 | ^^-^^ > (403)220-7873 fax:(403)284-0074 | > e-mail: maurice at phas.ucalgary.ca > > > >