Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*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 2000

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

Search the Archive

Re: Getting coordinates of array member-

  • To: mathgroup at smc.vnet.net
  • Subject: [mg26251] Re: [mg26247] Getting coordinates of array member-
  • From: Maarten.vanderBurgt at icos.be
  • Date: Sun, 10 Dec 2000 00:19:28 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Herbert,

try this:

In[2] := M = Partition[Range[1, 9], 3]
Out[2] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}

In[3] := M[[3, 1]]
Out[3] = 7

In[4] := Position[M, 7]
Out[4 ]= {{3, 1}}

Maarten van der Burgt
Leuven, Belgium





"Stephane Hebert" <stephhebert at yourpants~videotron.ca> on 06-12-2000
08:16:29 AM


Subject: [mg26251]  [mg26247] Getting coordinates of array member




Hi folks,

Ok, let's say I have this

     1  2  3
    -----------
 1| 1  2  3
 2| 4  5  6
 3| 7  8  9

A 3x3 matrice or array.  Each number in the array represents its' position
from top left to bottom right.

What I need to do is:

Find what position 1,3 is.  Just by looking at the array, we find that 7 is
the answer.

Find what are the coordinates of 7.  Again just by looking at the array we
see that the answer is 1,3

I need to come up with a simplu function that will return these.

pos = GetPos(x,y)

coord = GetCoord(pos)

I've done this before, way long ago and can't find it.

Thanks.


--
Stephane Hebert
=========================
stephhebert at yourpants~videotron.ca
Remove yourpants~ to reply
=========================








  • Prev by Date: Re: transposing an equation
  • Next by Date: Re: transposing an equation
  • Previous by thread: Re: Getting coordinates of array member
  • Next by thread: Graphics3D[Plot3D[]] vs. ParametricPlot3D[]