How do I delete bytes from the end of a binary file?
7 views (last 30 days)
Show older comments
For context, I'm taking a binary file that includes a basic header of known formatting, an extended header of unknown formatting, and a series of data packets with known formatting, and removing some of the data packets. My idea is to duplicate the file, keep its basic and extended header, write the data packets that I wish to keep over the bytes encoding all the data packets, and then delete the remaining old data packet bytes following the newly overwritten data packet bytes. I'm not sure how to delete the remaining bytes.
I would just copy the headers with the data packets to keep to a new file, but since the extended header formatting is unknown and values are encoded in the headers with varying precision, I don't think this would work.
0 Comments
Answers (1)
Walter Roberson
on 28 Mar 2024
Unfortunately MATLAB does not support any truncation operations for files.
0 Comments
See Also
Categories
Find more on Data Import and Export in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!