when i write doesn't displays anything

조회 수: 2 (최근 30일)
lafnath p
lafnath p 2016년 10월 28일
댓글: lafnath p 2016년 10월 28일
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일
% 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
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개)

카테고리

Help CenterFile Exchange에서 Low-Level File I/O에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by