Error using ==> textscan Error

3 visualizaciones (últimos 30 días)
Mick
Mick el 29 de Nov. de 2013
Comentada: Simon el 29 de Nov. de 2013
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!

Respuestas (1)

Simon
Simon el 29 de Nov. de 2013
What is "fid"? Is it empty ...?
  2 comentarios
Mick
Mick el 29 de Nov. de 2013
Editada: Mick el 29 de Nov. de 2013
It is a file directory(path) and...isn't supposed to be empty
Simon
Simon el 29 de Nov. de 2013
Are you sure, did you check that? The error message you reported looks like fid is empty.

Iniciar sesión para comentar.

Categorías

Más información sobre Data Import and Export en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by