MATLAB Answers

I am trying to run the following code. i am getting an error in line 15 as "Subscript indices must either be real positive integers or logicals".

1 view (last 30 days)
jeffin
jeffin on 12 Sep 2014
Commented: Fox Peterson on 12 Sep 2014
mbCount = 1; for i = 1:mbSize:row-mbSize+1 for j = 1:mbSize:col-mbSize+1
% dy is row(vertical) index
% dx is col(horizontal) index
% this means we are scanning in order
dy = motionVect(1,mbCount);
dx = motionVect(2,mbCount);
refBlkVer = i + dy;
refBlkHor = j + dx;
imageComp(i:i+mbSize-1,j:j+mbSize-1) = imgI(refBlkVer:refBlkVer+mbSize-1, refBlkHor:refBlkHor+mbSize-1); --line 15
mbCount = mbCount + 1;
end
end
Kindly help me. Thanks in advance.

  2 Comments

Fox Peterson
Fox Peterson on 12 Sep 2014
also check on mbSize (is a real positive integer?) , since it's in the range definitions for i and j. also, are there instances where col-mbSize + 1 or row - mbSize + 1 could be less than 1? for example, if mbSize is 20 and col is 10, then 1:20:10-20+1 would not work...

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!