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 Exchange에서 Search 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