Re: Element extraction
- To: mathgroup at smc.vnet.net
 - Subject: [mg19645] Re: [mg19579] Element extraction
 - From: "Wolf, Hartmut" <hwolf at debis.com>
 - Date: Tue, 7 Sep 1999 00:28:38 -0400
 - Organization: debis Systemhaus
 - References: <199909040534.BAA04500@smc.vnet.net.>
 - Sender: owner-wri-mathgroup at wolfram.com
 
Mark Lawrence Storch schrieb:
> 
> Hello,
>     I am having a bit of trouble trying to extract elements out of
> nested lists.  I have an X x Y array where each element of the array is
> a 3x3 matrix.  I am trying to make density plots of each component.  For
> example, I would like to plot the 1,1 components of each element of the
> larger array.  I have tried the following:
> 
> Array[g[[i,j][[a,b]],{i,Dimensions[g][[1]]},{j,Dimensions[g][[2]]}]
> 
> where I am trying to get the a,b component
> 
> This does not work, and I am not seeing exactly why not.  I am hoping
> someone can point out my error or suggest a way to extract the lists I
> need.
> 
Hello Mark,
perhaps what you need is
   Map[#[[m, n]] &, data, {2}]
Observe
In[1]:=
m[i_, j_] := Table[Sin[(x i^2 + y j^2  )2Pi/5], {x, -1, 1}, {y, -1, 1}]
In[2]:=
data = Array[m, {25, 30}];
In[3]:=
gra = Table[
      ListDensityPlot[Map[#[[i, j]] &, data, {2}], 
        DisplayFunction -> Identity], {i, 3}, {j, 3}];
In[4]:=
Show[GraphicsArray[gra], DisplayFunction -> $DisplayFunction]
...then you'll see a 3 X 3 array of Density Graphics (with 25 x 30
Pixels each)
Kind regards, hw
- References:
- Element extraction
- From: Mark Lawrence Storch <mscc+@andrew.cmu.edu>
 
 
 - Element extraction