How do I delete bytes from the end of a binary file?

8 vues (au cours des 30 derniers jours)
Phelix
Phelix le 28 Mar 2024
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.

Réponses (1)

Walter Roberson
Walter Roberson le 28 Mar 2024
Unfortunately MATLAB does not support any truncation operations for files.

Catégories

En savoir plus sur Data Import and Analysis dans Help Center et File Exchange

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by