Error using ==> textscan Error

조회 수: 10 (최근 30일)
Mick
Mick 2013년 11월 29일
댓글: Simon 2013년 11월 29일
Hi,
I keep receiving the following error: Error using ==> textscan First input cannot be empty with the following code:
function ceaContent = read_textfile(chrPath)
% initialize return-values
ceaContent = {};
try
%open textfile
fid = fopen(chrPath);
Direc = dir(chrPath);
ceaContent = textscan(fid, '%s', 'Delimiter', '\n', 'whitespace', '', 'bufsize', max(Direc.bytes, 4095));
ceaContent = ceaContent{0};
ceaContent = ceaContent(~ismember(strtrim(ceaContent), ''));
fclose(fid);
catch %#ok<CTCH>
try fclose(fid); end %#ok<TRYNC>
Thanks for the help!

답변 (1개)

Simon
Simon 2013년 11월 29일
What is "fid"? Is it empty ...?
  댓글 수: 2
Mick
Mick 2013년 11월 29일
편집: Mick 2013년 11월 29일
It is a file directory(path) and...isn't supposed to be empty
Simon
Simon 2013년 11월 29일
Are you sure, did you check that? The error message you reported looks like fid is empty.

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

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by