Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: large matrix mapping
Date: Mon, 18 Apr 2011 00:46:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 22
Message-ID: <iog1kc$5aa$1@fred.mathworks.com>
References: <iofn4o$r6a$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-01-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1303087564 5450 172.30.248.46 (18 Apr 2011 00:46:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 18 Apr 2011 00:46:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:722391

"Herbert" wrote in message <iofn4o$r6a$1@fred.mathworks.com>...
> Hey,
> 
> I've got following problem:
> I have a (n,m) Matrix with integer values from 1 to 2^24 and a (1,2^24) LookupTable.
> LookupTable(1,3) contains the new value for "3". Now i want to map every value from the (n,m) Matrix to its new value.
> 
> e.g.
> 
> oldMatrix=[ 1 2 5; 2 3 6]
> and 
> LookupTable=[12 2 54 23 68 95 1 6 ...]
> 
> the new Matrix should be:
> newMatrix=[12 2 68; 2 54 95]
> 
> is there any function which help me doing such mapping? or do you have any ideas how to do this fast?
> thanks for your help in advance!
- - - - - - - - - -
 newMatrix = reshape(LookupTable(oldMatrix),size(oldMatrix));

Roger Stafford