# What is error(19) or error(15): out of bound(1)...how to resolve?

4 messages
Open this post in threaded view
|

## What is error(19) or error(15): out of bound(1)...how to resolve?

 please tell me...m solving an optimization problem with inequality constraints.  The error m getting while running my code is : "error: x(15): out of bound 1" please let me know...what is the error and how to resolve this. -- Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|

## Re: What is error(19) or error(15): out of bound(1)...how to resolve?

 On Sat, Oct 27, 2018 at 4:36 PM Satyaballi <[hidden email]> wrote:please tell me...m solving an optimization problem with inequality constraints.  The error m getting while running my code is : "error: x(15): out of bound 1" please let me know...what is the error and how to resolve this. -- Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html Hi Satyaballi,Out of bounds errors occur when you're trying to access a vector with an index that is larger than its length.  For example,>> x = zeros(1,10);>> x(12)error: x(12): out of bound 10>>So, from the error you gave, on line 44 of the g function, the vector x (which has size 1) is trying to be accessed by an index of 15.  Usually in these cases, if I can't figure out why this is happening, I either put a breakpoint at that line and see what the value of the offending vector (or index) or place an if/endif statement to check to see if the size of x is 1 (in this case) since you obviously are assuming that it is longer than that.Hope this helps,James Sherman Jr.