﻿'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
