Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Out of bound Error
Replies: 5   Last Post: Feb 20, 2013 1:18 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dpb

Posts: 8,250
Registered: 6/7/07
Re: Out of bound Error
Posted: Feb 20, 2013 10:51 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 2/20/2013 9:21 AM, Jerome wrote:
> I get the following error and I am unsure how to fix it. I tried to edit
> the rows and cols but it seems not to work. Does anyone know a quick fix
> to this problem:
>
> ??? 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
> *cxy(i,j)*cx(i,j)*cy(i,j) +
> cxx(i,j)*cy(i,j)*cy(i,j))/((1+cx(i,j)*cx(i,j) +
> cy(i,j)*cy(i,j))^1.5);
>
>

...

> [row col] = size(image);
...

> for i = 1:row
> for j= 1:col-1
> eterm(i,j) = (cyy(i,j)*cx(i,j)*cx(i,j)...
> end
> end


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
possible the code that is being executed isn't what you're looking at
and have posted but a cached or aliased copy.

which snake % see where the actually-referenced copy is
clear snake % clear any cached copies

--




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.