How do I delete bytes from the end of a binary file?
8 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Walter Roberson
2024-3-28
Unfortunately MATLAB does not support any truncation operations for files.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!