MathGroup Archive 2007

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

Search the Archive

Re: Bitmap data extraction (matrix of matrix)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg76508] Re: Bitmap data extraction (matrix of matrix)
  • From: Uncle Paul <paul at desinc.com>
  • Date: Wed, 23 May 2007 05:25:42 -0400 (EDT)
  • References: <f2u51n$k09$1@smc.vnet.net>

On Tue, 22 May 2007 07:10:47 +0000 (UTC), mkorneck at nd.edu wrote:

>RGB = {{1,0,1},{2,3,2},{4,6,4},{3,2,1}}
>                    {{9,1,3},{3,2,1},{4,3,3},{5,3,2}}


RGB /. {r_, g_, b_} ->  {r}   (* using rules  *)

out: {{1}, {2}, {4}, {3}, {9}, {3}, {4}, {5}}

Note:   Use Flatten[] to further simplify if you want just a list.




Table[
   {RGB[[i, 1]]}, 
    {i, 1, Length[RGB]}]   (* using Functional programming *)

out: {{1}, {2}, {4}, {3}, {9}, {3}, {4}, {5}}

Note:  You don't need to use Flatten[].  You can just delete the {} in
Table.  I.e. {RGB[[i, 1]]},   becomes   RGB[[i, 1]], 

Paul McHale


  • Prev by Date: Re: Re: Wolfram Research 2+12 degree-of-freedom gamepad?
  • Next by Date: Re: 3 lines of code which crashes Mathematica every time
  • Previous by thread: Re: Bitmap data extraction (matrix of matrix)
  • Next by thread: Re: Bitmap data extraction (matrix of matrix)