deleting 2 end points

Hi forum,

How to delete two end points of a wave for any wave size?

I know I can use

DeletePoints 136,1, My_wave1
DeletePoints 0,1, My_wave1     

in this case My_wave1 has 136 points and yes this way I can delete two end points , but since i will add this to my procedure, I am loading waves with say 150, 120 points or other sizes. what do you suggest ?

Thank you,

For arbitrary 1D waves you could use the following:

Redimension/n=(DimSize(waveName,0)-2) waveName

You could use a similar approach with DeletePoints.

Hi,

That removes the last two points which is I take to be different than the request. I am reading it as remove the first and last point.

Given that, perhaps something along these lines. Note order of deletion do the last point first since deleting the first point shrinks the length of the wave and you will get an out of index error.

Function TrimEndsofWave(WaveIn)
    wave WaveIn
   
    Variable EndOfWave
    EndOfWave = numpnts(WaveIn)-1 //remember 0 based indexing so last index point is length -1
    DeletePoints EndOfWave,1, WaveIn
    DeletePoints 0,1,WaveIn
   
End

Andy

Sorry if I misunderstood the OP.  If indeed first and last are to be eliminated (1D wave) then using IP8:

 

MatrixOP/o waveName=subRange(waveName,1,numRows(waveName)-2,0,0)