View Raw SPL
/*****************************************************************************
* *
* GETYR.SPL Copyright (C) 2010 DSP Development Corporation *
* All Rights Reserved *
* *
* Author: Randy Race *
* *
* Synopsis: Returns the Y value of the rightmost displayed series *
* *
* Revisions: 2 Dec 2010 RRR Creation *
* *
*****************************************************************************/
#if @HELP_GETYR
GETYR
Purpose: Returns the rightmost Y value of a series displayed in a Window.
Syntax: GETYR(window)
(y, idx) = GETYR(window)
window - Optional, a Window. Defaults to the current Window.
Returns: A real or complex value, the rightmost Y value.
(y, idx) = GETYR(window) returns the Y value and associated index.
Example:
W1: 1..0.1..10;setx(5, 9);
yr = GETYR(W1);
yr == 9.0
indicating that the rightmost sample of the series displayed in
W1 has a value of 9.0.
Example:
W1: 1..0.1..10;setx(5, 9);
(yr, idx) = GETYR(W1);
yr == 9.0
idx == 81
indicating that the rightmost sample of the series displayed in
W1 has a value of 9.0 an occurs at index 81.
Remarks:
GETYR returns Y value of the rightmost displayed series.
See Also:
Idxtox
Getxl
Getxr
Getxridx
Getyl
Xtoidx
#endif
/* get rightmost series value */
getyr(win)
{
local yr, idx;
if (argc < 1) win = refwindow(w0);
/* convert rightmost X value to series value */
idx = getxridx(win);
yr = getpt(win, idx);
if (outargc > 1)
{
/* value and index */
return(yr, idx);
}
else
{
return(yr);
}
}