Resources

Index out of range

0

I am trying to run some code on my data.  GAUSS reports the error message below.

error G0058 : Index out of range

Does anyone know what this means?

Thank you!

Tags: asked February 25, 2013

1 Answer

0

Index out of range means that the code is trying to access a matrix or vector outside of its bounds. For example:

x = rndn(5, 1);
y = x[6, 1];

would cause this error, because it is trying to access the 6th element out of a total of 5. This can also happen if the value you using as an index is an Infinity, Nan or missing value. For example:

idx = 1/0;
x = ones(5, 1);
y = x[idx];

would also return this error.