how to use fread function?

조회 수: 2 (최근 30일)
missy QIANHUI
missy QIANHUI 2011년 10월 20일
i have a text file with the following data:
(0 0)
(0 3)
(3 3)
(3 0)
i have use the following to read the text file and its work
fid=fopen('Anchor.txt');
line=fgets(fid);
while ischar(line)
disp(line)
line=fgets(fid);
now i want to use fread but it doesnt seen to work. is there an example that someone can share with me to read a text file using fread. thanks end
[EDITED, JSimon, 20-Oct-2011 11:58, code formatted]
  댓글 수: 1
Jan
Jan 2011년 10월 20일
Please use code formatting as explained in the "Markup help" link on this page.
It would be helpful, if you post the code, which causes the problems, and describe these problems with all necessary details. Currently you have shown us the code, which does *not* cause problems...

댓글을 달려면 로그인하십시오.

답변 (1개)

Jonas Reber
Jonas Reber 2011년 10월 20일
have a look at the documentation of fread: http://www.mathworks.ch/help/techdoc/ref/fread.html you might be looking for:
A = fread(fid, '*char')'
but why would you want to read a textfile in binary mode (fread)?
  댓글 수: 1
missy QIANHUI
missy QIANHUI 2011년 10월 27일
thank you :)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by