Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图用二进制代码写入文件。在mathematica中,我有一些用霍夫曼代码编码的刺痛,我需要将它们写入二进制文件并查看文件大小。
最好的方法是什么?
谢谢。
您应该能够将此过程用于您的目的。这里创建了一些二进制数据file并以二进制格式写入streamoutput.gif:
file
streamoutput.gif
file = ExportString[Graphics[Disk[]], "GIF"]; stream = OpenWrite["streamoutput.gif", BinaryFormat -> True]; BinaryWrite[stream, file]; Close[stream]; Import["streamoutput.gif"]
来源: 使用 ExportString 转换图形