how to calculate interquartile range of numeric wave

Hi all,

I am wondering, if there is a function in igor to calculate interquartile range of a numeric waves. The alternative is to calculate the first and third quartile. However, I still need a command to calculate these 2 quartiles. 

My code in progress is as the following:

#pragma TextEncoding = "UTF-8"
#pragma rtGlobals=3     // Use modern global access method and strict wave access.

Function medianGaussian(JVmatrice)
    wave JVmatrice // 2D wave

    Variable sum=0
    Variable i=0 // We use i as the loop variable.
    Make/O/N=(dimSize(JVmatrice,1)), JV
    Make/O/N = (dimSize(JVmatrice,0)), tempwave
    Make/N=800/O tempHist;DelayUpdate
    do
        tempwave = JVmatrice[p][i]
        JV[i]=median(tempwave)
        Histogram/C/B={-7,0.1,800} tempwave,tempHist;DelayUpdate
        CurveFit gauss tempHist /D
        print(JV[i])

        //calculate inter quartile range
        //print(W_coef[1])
        //print(W_coef[2])
        //print(W_coef[3])
        //print(W_coef[4])

        i += 1
    while(i < dimSize(JVmatrice,1))

    return JV[i-1] 
End

 

Use StatsQuantiles. IQR is stored in the variable V_IQR and in the wave W_StatsQuantiles