Good wishes for the New year.
I want to read data that are coming from a device. These data are organized in frames with a fixed structure each one. To give an example I want to read a file “Data.dat” with 100 frames. I intend to do something like
‘’'struct Frame # frame consists of a string with 13 chars, 10 Int16, and 20 Float32=113Byte
s::String{13}
n::Vector{Int16}(undef,10)
x::Vector{Float32}(undef,20)
end
f=open(“Data.dat”,“r”) # open file
for i=1:100 # read 100 frames
read!(f,Frame) # read one frame to have access to Frame.s, Frame.n, and Frame.x
end
close(f) # close file
‘’’
Of course, this snippet of code doesn’t work. But I hope I could express my intention.
How must the code look like to work?
Best regards Zweta