when i write doesn't displays anything

fid = fopen('new.bin','w');
A= [1 2 3 4];
fwrite(fid,A);
fclose(fid);
this code doesn't gives any data in the bin file when i open that file in matlab i didn't see anything.

 採用された回答

KSSV
KSSV 2016 年 10 月 28 日

0 投票

% Wrtie a binary file
fid = fopen('new.bin','w');
A= [1 2 3 4];
fwrite(fid,A);
fclose(fid);
% Read the file created
fid = fopen('new.bin','r') ;
A = fread(fileID) ;
fclose(fid)
A
It is working fine. You are writing data to a binary file, use fread to read the file created.
Note: You asked many questions and accepted no answer so far. You must acknowledge the people who spent time to answer your queries. You have to accept the answer.

3 件のコメント

lafnath p
lafnath p 2016 年 10 月 28 日
but its reads in column wise .how can i get data as row wise.
KSSV
KSSV 2016 年 10 月 28 日
編集済み: KSSV 2016 年 10 月 28 日
As you know the format while you have written the file. You can read the file as below:
fid = fopen('new.bin','r') ;
A = fread(fileID,[1 4]) ;
fclose(fid) ;
A
I suggest you to read documentation part of fread.
lafnath p
lafnath p 2016 年 10 月 28 日
thank you..

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLarge Files and Big Data についてさらに検索

タグ

タグが未入力です。

質問済み:

2016 年 10 月 28 日

コメント済み:

2016 年 10 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by