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:
LUT/vectorize this for-loop

Subject: LUT/vectorize this for-loop

From: Louis

Date: 12 Feb, 2013 16:07:20

Message: 1 of 2

Hello,

I have been dabbling trying to make a look-up table mapping for this tedious for-loop but I wasn't successful. Here is the code and explanation of what I am trying to do:

for kk=1:size(aa,1)
imageModified(aa(kk,1),aa(kk,2))=img(aa(kk,3),aa(kk,4));
end

My 'kk' is in order of millions for this loop is somehow time consuming.

Basically, I have a matrix called 'aa'.

'aa' is some Nx4 matrix where each row has mapping values.

What I want to do is going through row by row of matrix 'aa' and map image value 'img' to its corresponding place in image 'imageModified'.

For example,

Let's say aa=[ 50 40 60 70 ;
                    2 56 28 10 ;
                      .... ]

So what I want to do is: map img(50,40) value to location imgModified(60,70). Map map img(2,56) value to location imgModified(28,10). And do that for aa N rows.

Thank you in advance,

Subject: LUT/vectorize this for-loop

From: Louis

Date: 12 Feb, 2013 16:14:06

Message: 2 of 2

Solved here:

http://www.mathworks.com/matlabcentral/answers/63186-how-can-i-vectorize-lut-this-for-loop

Regards

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