Borrar filtros
Borrar filtros

How to judge "load" function

4 visualizaciones (últimos 30 días)
Jerry
Jerry el 10 de Mzo. de 2012
Hi guys:
Is there a way to judge whether a '.txt' file could be loaded by "load" function?
Some of my files are matrix which could be loaded by "load" but some are not.
Is there a way to separate them?
Thanks a lot

Respuesta aceptada

Ken Atwell
Ken Atwell el 10 de Mzo. de 2012
You could perform the load in a try/catch block and react accordingly:
try
load(filename);
catch e
% Something went wrong -- not a valid file to load?
end
  1 comentario
Jerry
Jerry el 10 de Mzo. de 2012
Thanks a lot.
Forgot the matlab has try.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by