How to write data to a binary file?

17 ビュー (過去 30 日間)
LINGJUN KONG
LINGJUN KONG 2017 年 7 月 21 日
回答済み: Navaneetha C M 2018 年 1 月 18 日
I have a array data with 60,000*784*double. and I want to save them into a file by binary.
file=fopen('myfilelocation\data.bin','w');
fwrite(file,data,'double');
fclose(file);
the file was created and the size of the file is also 376,320,000 bytes. which means there are 60,000*784*8 bytes data in the file.
but when I open the file by other software, the content is all Null.
what's the reason? is that because of my data is too large?
  1 件のコメント
James Tursa
James Tursa 2017 年 7 月 21 日
編集済み: James Tursa 2017 年 7 月 21 日
What do you get when you read it back into MATLAB? What about opening the file in a binary editor to see what is there?

サインインしてコメントする。

回答 (1 件)

Navaneetha C M
Navaneetha C M 2018 年 1 月 18 日
The content of the file may not be parsed correctly by other software. You can use 'fread' function to read the contents of the file.

カテゴリ

Help Center および File Exchange文本文件 についてさらに検索

Community Treasure Hunt

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

Start Hunting!