Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

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



  • Prev by Date: Re: crystal structure?
  • Next by Date: Re: Re: Langford's Problem (another solution improved)
  • Previous by thread: Element extraction
  • Next by thread: Re: Element extraction