Mean of several waves

I am looking for a quick method to average a specific range in several waves (hundreds of sweeps from electrophysiological recordings). Let's say each of my waves goes from 0 to 100 seconds in the X axis, I would like to average the Y value of the segment from 0 to 30 s from each sweep and place all the averages in a separate wave for further manipulation.

Can anybody suggest a quick command for this, without having to run

mean(waveName [, x1, x2 ] )

for every single wave?

Thanks
Here is one approach -- just trying to avoid loops:
If you stored all your 1D waves as columns of a 2D matrix wave you can then define the range [x1,x2] using a mask wave (another 2D wave of the same dimensions with 0's in all rows outside [x1,x2]. The mean that you seek is then given by:
Variable numPointsInRange=x2pnt(oneDwave,x2)-x2pnt(oneDwave,x1)+1
MatrixOP/O aa=sumCols(maskWave*dataWave)/numPointsInRange
Here is an untested solution that uses a loop but does not require storing your existing waves in a 2D wave. It requires that you generate a semicolon-separated list of wave names for your input waves. If your waves are named systematically (e.g., wave0, wave1, . . .) this could be done programmatically.

Function Demo(list, startX, endX, outputWaveName)
    String list             // Semicolon-separated list of wave names in current data folder (e.g., "wave0;wave1;wave2;")
    Variable startX, endX
    String outputWaveName       // Desired output wave name
   
    Variable numWaves = ItemsInList(list)
   
    Make /D /O /N=(numWaves) $outputWaveName        // Overwrites !!!
    Wave averages = $outputWaveName // Create local wave reference

    Variable i
    for(i=0; i<numWaves; i+=1)
        String name = StringFromList(i, list)
        Wave w = $name
        averages[i] = mean(w,startX,endX)
    endfor
End


That said, there are many advantages to storing 1D data as columns of a 2D wave such as reduced clutter and the ability to index a column in a simple fashion. You might consider adopting a 2D wave as your standard storage.

Columns of 2D waves can be graphed individually. You can also curve fit to them. For most other operations (e.g., Smooth, Integrate, Convolve) you would need to extract the column of interest to a 1D wave.
Thanks very much to both. I will try both solutions and see which suits best.