#pragma rtGlobals=1 // Use modern global access method. Function SwWave(Foldername,PosWavePrefix,NegWavePrefix,Temperature,posthres1,posthres2,negthres1,negthres2) //thresholds need to be indexed as well Wave Temperature Variable Foldername,PosWavePrefix,NegWavePrefix,posthres1,posthres2,negthres1,negthres2 Variable NumT,h,i,j,k,l, NumPointsPosSwWave,NumPointsNegSwWave //might have to define PosFilename PosWavename etc. I don't think so, but maybe SVAR PosFilename, NegFilename, PosLowWave, PosMediumWave, PosLargeWave, NegLowWave, NegMediumWave, NegLargeWave Wave PositiveWave,NegativeWave h=0 For (h=4; hposthres2[h]) //Large Current Waves InsertPoints k,1,$PosLargeWave $PosLargeWave[k]=$PosWavename[i] k+=1 else InsertPoints l,1,$PosMediumWave //Medium Current Waves $PosMediumWave[l]=$PosWavename[i] l+=1 endif i+=1 while (inegthres2[h]) //Large Current Waves InsertPoints k,1,$NegLargeWave $NegLargeWave[k]=$NegWavename[i] k+=1 else InsertPoints l,1,$NegMediumWave //Medium Current Waves $NegMediumWave[l]=$NegWavename[i] l+=1 endif i+=1 while (i