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.

Respuestas (1)

Walter Roberson
Walter Roberson el 23 de Abr. de 2016
Variables cannot be directories. Variables can be strings that name directories. Example:
Testvar = 'data7'
exist(Testvar,'dir')

Categorías

Más información sobre Search Path en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 23 de Abr. de 2016

Respondida:

el 23 de Abr. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by