This article contains a sample script for thinning your data by every nth point.
To run this script:
- Copy the script below, or download the attached BAS file: DataThin.bas.
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Surfer 15\Scripter.
- Double click on Scripter.exe to launch Scripter.
- Press Ctrl+A to select all of the existing lines then press Delete.
- If you copied this script, press Ctrl+V to paste it into Scripter. If you downloaded it, click File | Open, select the BAS file from your downloads directory, and click Open.
- Click Script | Run to run the script.
'DataThin.bas reads the data file and writes every nth point to a new file. Sub Main Debug.Print "----- ";Time;" -----" file1 = GetFilePath(,"dat;txt;xyz",,"Open Data File") n = InputBox("Read every n-th data point","Enter 'n'","2") file2 = Left(file1,Len(file1)-4)+"_Thinned_"+n+".dat" Open file1 For Input As #1 Open file2 For Output As #2 linenum = 0 While Not EOF(1) For i = 1 To n Line Input #1,a Next i Print #2,a Wend Debug.Print file2+" has been created." MsgBox(file2+" has been created.") End Sub
Updated October 10, 2017