필터 지우기
필터 지우기

fread - each character in new line

조회 수: 4 (최근 30일)
Anke Kügler
Anke Kügler 2016년 6월 24일
댓글: Anke Kügler 2016년 6월 24일
Hi,
I'm trying to read some information from the header of a wave file (fullname is the file with absolute path) using
fid = fopen(fullname);
fseek(fid,364,'bof');
string=fread(fid,24,'char');
However, each character will be on a new line in the string. I don't know if this is like this in the header or a result of fread. How do it get all the characters to be in one line? I tried to google, but didn't really know what to look for and didn't find anything.
Any help very appreciated. Thanks!

채택된 답변

Walter Roberson
Walter Roberson 2016년 6월 24일
When you specify a scalar size for fread() the default is to create an N x 1 vector. You should use
string = fread(fid, [1, 24], 'char');
  댓글 수: 1
Anke Kügler
Anke Kügler 2016년 6월 24일
Thanks! That makes sense :)

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

추가 답변 (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