# wavename(rightx(wavename)) out of range

I'm not able to use this, it's out of range. I can modify things so I'm just to the left of rightx, but is there a way to make this work?
Could you post a short example that reproduces this issue (and the Igor version)?
I tried
make test
setscale x 0,42,test
test(rightx(test))=42

without an error in IP6.38B01 and IP700B04.
HJ
Execute this:
Make/O/N=2 test
SetScale x 0, 2, "s", test
Print pnt2x(test,0)
Print pnt2x(test,1)
Edit test.id

Note that there is no X value equal to 2. For an explanation, look at the documentation for SetScale.

Instead of "wavename(rightx(wavename))", execute:
Variable lastPoint = numpnts(test) -1
Print test[lastPoint]

or
Variable lastPoint = numpnts(test) -1
Variable lastX = pnt2x(test,lastPoint)
Print test(lastX)

It's actually more the definition of `rightx`.
rightx(waveName )
The rightx function returns the X value corresponding to point N of the named 1D wave of length N.
Details:
Note that the point numbers in a wave run from 0 to N-1 so there is no point with this X value.

I wonder why writing is "allowed" but reading is not (I'm aware of the rounding / interpolating behavior upon usage of "()" -- It's more a fundamental wondering: I would give an error message in both cases.)
Make/O/N=2 test
SetScale x 0, 2, "s", test
Edit test.id
test(rightx(test))=42  // no error and stored in test[1]
print test(rightx(test))  // OoR error

HJ
So, why doesn't rightx actually return the rightx? It returns the real rightx + deltax.
geologic wrote:
So, why doesn't rightx actually return the rightx? It returns the real rightx + deltax.

I am guessing a bit here, but in the wording of the SetScale dialog (Data... Change Wave Scaling...) 'Start' and 'End' refer to the x-values of the first and last points where as 'Start' and Right' refer to the first and last-plus-one points.
This makes sense of you look at the x-scaling of the following:
Make/O/N=10 w1, w2
SetScale/I x 0,20,"", w1
SetScale x 0,20,"", w2
Edit w1.id,w2.id

Here w1 uses Start and End option, and the x-scale is 0, 2.22, 4.44, ... 20;
and w2 uses the Start and Right option, and the x-scale is 0, 2, 4, ... 18.
It all depends upon what the x-scale actually means in your data.
Hope this helps,
Kurt