comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: gaussfit returning errors
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: gaussfit returning errors [message #36237] Thu, 28 August 2003 08:16
Chris Lee is currently offline  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.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: gaussfit returning errors
Next Topic: Code Metrics tools for IDL

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 21:10:01 PDT 2025

Total time taken to generate the page: 4.08225 seconds