Read mixed ascii and binary file

5 views (last 30 days)
Markella Zormpa
Markella Zormpa on 27 Sep 2022
Commented: Markella Zormpa on 30 Sep 2022
Hello community,
I have a file that looks like this:
it is a mix between ascii and binary characters (attached as well as a file). The equivalent ascii file looks like this:
and contains lines with many elements.
I'd like to read the binary version of the file as it can get quite large (ie 100G and more!).
Any ideas?
Thank you very much in advance
Markella
  5 Comments
Walter Roberson
Walter Roberson on 28 Sep 2022
https://youtu.be/K-nAF3qAPTc time 6:30 the number is the number of elements that appear in the list below.
Markella Zormpa
Markella Zormpa on 30 Sep 2022
Hi everyone,
Sorry I just realized I posted two files that don't correspond to each other! Apologies for the confusion. Here are the correct formats attached. Ubinary.txt for the binary-ascii mixed file and Uascii.txt for the purely ascii file.
So the format of the file is the following:
  • N lines that start with "#" and define points that are sampled in a field -- in both binary file and ascii those lines are present.
  • 2 lines that also start with "#" and are other headers -- in both binary file and ascii those lines are present.
  • Follow many lines, the format of which is in ascii:
t1 (ux_0 uy_0 uz_0) (ux_1 uy_1 uz_1) .. (ux_{N-1} uy_{N-1} uz_{N-1})
t2 (ux_0 uy_0 uz_0) (ux_1 uy_1 uz_1) .. (ux_{N-1} uy_{N-1} uz_{N-1})
.
.
.
and so on, all the t and u variables are doubles.
In binary, which is what I'm trying to read, the file appears to have a slightly different format
t1
nonuniform List<vector>
N
(..... encoded stuff ..... that can also be multiple lines .......)
t2
nonuniform List<vector>
N
(..... encoded stuff ..... that can also be multiple lines .......)
.
.
.
I'm assuming that the encoded stuff are N triplets (ie N vectors). The "Not Found" came up as a result of my set-up but I re-run it with a more correct set-up so we don't have to worry about it.
Sorry for the confusion, any ideas are much appreciated!
Thank you for your help
Markella

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!