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

New to MATLAB?

Storing images in matrix

Asked by James

James

on 16 Jul 2011
Accepted Answer by Walter Roberson

Walter Roberson

Hi

I am getting an error with my image processing algorithm, code given below:

for c = 2:50
Img = double(Video(1,c).cdata); 
r = c - 1; 
while (r>=1) 
if (c - r) >= 10 
break 
end 
     ImgR = double(Video(1,r).cdata); 
     NewFrame = Predicted_Function(Img, ImgR); 
     NewFrames(c,r) = NewFrame; 
     r = r - 1; 
     end

"??? Subscripted assignment dimension mismatch." error in line "NewFrames(c,r) = NewFrame"

Please Help!

0 Comments

James

James

Products

No products are associated with this question.

1 Answer

Answer by Walter Roberson

Walter Roberson

on 16 Jul 2011
Accepted answer

Your ImgR will be an array. What does Predicted_Function do with array inputs? If it returns an array, then you are expecting to store that array in the single location NewFrames(c,r).

Perhaps you want,

NewFrames(c,r).cdata = NewFrame;

0 Comments

Walter Roberson

Walter Roberson

Contact us