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