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,181
Registered: 6/7/07
Re: Out of bound Error
Posted: Feb 20, 2013 1:18 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 2/20/2013 10:00 AM, Jerome wrote:

...[top-posting repaired--don'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:col-1
>> > 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:col-1 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 guess--only you can know what it is you're attempting to
accomplish here.

--




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.