Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
large matrix mapping

Subject: large matrix mapping

From: Herbert

Date: 17 Apr, 2011 21:47:04

Message: 1 of 3

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!

Subject: large matrix mapping

From: Roger Stafford

Date: 18 Apr, 2011 00:46:04

Message: 2 of 3

"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

Subject: large matrix mapping

From: Yumnam Kirani

Date: 18 Apr, 2011 08:25:21

Message: 3 of 3

"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!

Already your old matrix is the index of the look-up table. So, you can directly find your new matrix as
newMatrix=LookupTable(oldMatrix);

Yumnam Kirani Singh
Tronglaobi Awang Leikai

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us