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

Learn moreOpportunities for recent engineering grads.

Apply Today
Asked by Internazionale on 4 Mar 2013

i have a problem. i have a cell A. cell A have 13*13 blocks (A{1,1},A{1,2},..., A{13,13})and every blocks have 8*8 pixels. i have matrix p 169*1 and matrix q 169*1.

i want to process them to find value A' = A*p + q.

example, A'{1,1} = (A{1,1}*p(1,1))+q(1,1).

next A'{1,2} = (A{1,2}*p(1,2))+q(1,2) and finally until A'{13,13}

*No products are associated with this question.*

Answer by Andrei Bobrov on 4 Mar 2013

Edited by Andrei Bobrov on 4 Mar 2013

out = A'; for jj = 1:numel(out) out{jj} = out{jj}*p(jj)+q(jj); end out = out';

Internazionale on 4 Mar 2013

i don't understand sir, when i try and add to my program, matlab undefined function and error in variable out. would you give me example from make cell A and p, q randomly.

## 3 Comments

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/65734#comment_133875

You cannot do that. p and q are 169*1 so p(1,2) and q(1,2) are indexing out of range since the largest defined second index for p and q is 1.

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/65734#comment_133877

p and q have 169 value, each value will be use to find A'.

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/65734#comment_133878

i have mini program, but p and q, i have decide just one value and a just 4*4 matrix.

a=rand(4,4);

p=2;

q=1;

for x=1:4

end

the different is A must 13*13 cell. p and q have 169 value because the A have 169 blocks.