Error using ==> textscan Error

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

0 个投票

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
Are you sure, did you check that? The error message you reported looks like fid is empty.

请先登录,再进行评论。

类别

在 帮助中心 和 File Exchange 中查找有关 Large Files and Big Data 的更多信息

提问:

2013-11-29

评论:

2013-11-29

Community Treasure Hunt

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

Start Hunting!

Translated by