
Find Areas of a Series of XY pairs


hrodstein
// FindXYAreas(xList, yList, destWaveName) // Finds areas of a series of XY pairs. // xList is a semicolon-separated list of X wave names. If xList contains only one // wave name then that wave is used as the X wave for all XY pairs. // yList is a semicolon-separated list of Y wave names. // // Example: // Make/O/N=6 xData=x, yData0=x, yData1=x+1, yData2=x+2 // String yList = WaveList("yData*", ";", "") // "yData0;yData1;yData2;" // FindXYAreas("xData;", yList, "xyAreas") // Edit xyAreas Function FindXYAreas(xList, yList, destWaveName) String xList // Semicolon-separated list of x waves String yList // Semicolon-separated list of y waves String destWaveName // Name for output wave. This wave is OVERWRITTEN. Variable numXWaves = ItemsInList(xList) Variable numYWaves = ItemsInList(yList) Make/O/N=(numYWaves) $destWaveName Wave dest = $destWaveName // Make wave reference Variable i for(i=0; i<numYWaves; i+=1) String xName if (numXWaves == 1) Wave xw = $StringFromList(0, xList) // Use the same X wave every time else Wave xw = $StringFromList(i, xList) // Use a different X wave every time endif String yName = StringFromList(i, yList) Wave yw = $yName Variable result = areaXY(xw, yw) dest[i] = result endfor End

Forum

Support

Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More