How to judge "load" function

2 ビュー (過去 30 日間)
Jerry
Jerry 2012 年 3 月 10 日
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

採用された回答

Ken Atwell
Ken Atwell 2012 年 3 月 10 日
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 件のコメント
Jerry
Jerry 2012 年 3 月 10 日
Thanks a lot.
Forgot the matlab has try.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by