Re: gaussfit returning errors [message #36237] |
Thu, 28 August 2003 08:16 |
Chris Lee
Messages: 101 Registered: August 2003
|
Senior Member |
|
|
In article <5c68fcce.0308280528.4c7d7b1@posting.google.com>, "Joanne
Taylor" <joanne.taylor@physics.cr.man.ac.uk> wrote:
> minimum=(gaussmin/bin)-1
> maximum=(gaussmax/bin)-1
> gaussXrange = xLabels(minimum:maximum) gaussYrange =
> ....
> ....
> I get the following error: % Subscript range values of the form low:high
> must be >= 0, < size, with low <= high: XLABELS.
> Joanne
Either Your minimum or your maximum are out of bounds for the array.
The array subscripts need to follow the c-like rules
0 <= minimum <= maximum
minimum <= maximum < n_elements(xlabels) - 1
One or more of the rules are being broken, generating the error.
You can either check the numbers before hand with "if" statements and ask
for a different number (keep asking using a "while" loop), or if you want
the default numbers to be 0:n_elements(xlabels) - 1 , you can force it
using > and <, e.g.
nx=n_elements(xlabels)
;as given, these lines have some redundancy, but are order independent.
minimum = minimum > 0 < maximum < (nx-1)
maximum = maximum > minimum > 0 < (nx -1)
;then carry on as before
gaussXrange=xlabels(minimum:maximum)
....
Chris.
|
|
|