This is the structure:
if true
% code
end
bw = New BinaryWriter(myStream)
bw.Write("My company ECG") // string
bw.Write("Version 1.0.0.0") //string
bw.Write("1001") 'String –Patient ID //string
bw.Write("001") 'String –Study ID //string
bw.Write("1") 'Integer –gender: 0 male,1 female //string
bw.Write("ECG") //string
bw.Write("500") //string
bw.Write("test") //string
bw.Write(datas_length) //long or int64
For i As Long = 0 To datas_length - 1
bw.Write(ChannelData(i)) //float
Next
bw.Write("Sample finished") //string
bw.Close()