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

8 ビュー (過去 30 日間)
Phelix
Phelix 2024 年 3 月 28 日 4:33
回答済み: Walter Roberson 2024 年 3 月 28 日 4:58
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.

回答 (1 件)

Walter Roberson
Walter Roberson 2024 年 3 月 28 日 4:58
Unfortunately MATLAB does not support any truncation operations for files.

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by