Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


dpb
Posts:
9,088
Registered:
6/7/07


Re: Out of bound Error
Posted:
Feb 20, 2013 1:18 PM


On 2/20/2013 10:00 AM, Jerome wrote:
...[topposting repaireddon't; hard conversation follow makes]...
> dpb <none@non.net> wrote in message <kg2rep$5p2$1@speranza.aioe.org>... >> On 2/20/2013 9:21 AM, Jerome wrote: ... >> > ??? Attempted to access cyy(1,901); index out of bounds because >> > size(cyy)=[700,900]. >> > >> > Error in ==> snake at 31 >> > eterm(i,j) = (cyy(i,j)*cx(i,j)*cx(i,j) 2 ...
>> >> > [row col] = size(image); >> ... >> >> > for i = 1:row >> > for j= 1:col1 >> > eterm(i,j) = (cyy(i,j)*cx(i,j)*cx(i,j)... ...
>> What does >> >> size(image) >> >> return? (Remove the ';' and rerun or use debug to stop and look) >> >> col must be >901 for the loop index j to be 901. Or, of course, it's ...
> The size of the image is : 700 x 2700
Well, what do you expect then? You're asking to access from 1:col1 for columns in cyy() which has only 900 columns but image() is 3x the width.
One obvious fix (for this specific problem, anyway) would be to run the loop over
[row,col=size(cyy);
but whether that has any bearing on the problem you're trying to solve is anybody's guessonly you can know what it is you're attempting to accomplish here.




