how to check whether variable is directory

I don't know whether a variable is a directory or not, but when I use exist or isdir, and it is not a directory, I get a fatal error.

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 4 月 23 日

0 投票

Variables cannot be directories. Variables can be strings that name directories. Example:
Testvar = 'data7'
exist(Testvar,'dir')

カテゴリ

ヘルプ センター および File ExchangeSearch Path についてさらに検索

タグ

質問済み:

2016 年 4 月 23 日

回答済み:

2016 年 4 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by