Extract Y Values at the cursor's X location for a bunch of plotted waves.

Place a cursor on a graph with a bunch of waves. This function will generate a table with a list of Y values corresponding to the X value of the cursor.
Function GetAllYValues()
    if(!strlen(CsrInfo(A)))
        return -1 // No cursor on the display.  
    endif
    Variable xx=xcsr(A)
    String traces=TraceNameList("",";",1)
    Variable i,numTraces=ItemsInList(traces)
    Make /o/n=(numTraces) YVals
    Make /o/T/n=(numTraces) TraceNames
    for(i=0;i<numTraces;i+=1)
        String trace=StringFromList(i,traces)
        Wave Wav=TraceNameToWaveRef("",trace)
        YVals[i]=Wav(xx)
        TraceNames[i]=trace
    endfor
    if(WinType("CsrYVals"))
        DoWindow /F CsrYVals
    else
        Edit /K=1 /N=CsrYVals TraceNames,YVals
    endif
End

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More