MathGroup Archive 2010

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

Search the Archive

Re: reading different locations of a matrix specified

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113869] Re: reading different locations of a matrix specified
  • From: "Nasser M. Abbasi" <nma at 12000.org>
  • Date: Tue, 16 Nov 2010 06:13:41 -0500 (EST)

On 11/16/2010 2:30 AM, Oliver Ruebenkoenig wrote:
> On Tue, 16 Nov 2010, Nasser M. Abbasi wrote:


>> While looking around, I Found one can use ##&  in place of Sequence
>>
>> ------------------------------------
>> A={{1,2,3},{4,5,6},{7,8,9}};
>> pos={{1,1},{3,3}};
>>
>> A[[ ##&  @@ #]]&  /@ pos
>> ---------------------------
>>
>> {1,9}


>>
>
> Extract[A, pos]
>

That is even shorter and better!  Thanks Oliver, I have to remember Extract
from now on, looks like a very useful command.

--Nasser

  



  • Prev by Date: Re: sq[x_]:=x*x vs sq=Function[x, x*x]
  • Next by Date: Re: reading different locations of a matrix specified
  • Previous by thread: Mathematica 8 is now available
  • Next by thread: Re: reading different locations of a matrix specified