isenv
Determine if an environment variable exists.
📝Syntax
tf = isenv(env_name)
📥Input Arguments
Parameter Description
env_name string scalar, character vector, string array, cell array of character vectors: environment variable name.
📤Output Arguments
Parameter Description
tf logical: true if the environment variable is defined, false otherwise.
📄Description

isenv returns true if the environment variable env_name is defined in the current process environment, even when its value is empty.

If env_name is a nonscalar string array or cell array of character vectors, then tf has the same dimensions as env_name.

💡Examples
setenv('MY_ENV_VAR', 'funvalue')
isenv('MY_ENV_VAR')
isenv('A_VARIABLE_THAT_DOES_NOT_EXIST')
isenv(["MY_ENV_VAR", "A_VARIABLE_THAT_DOES_NOT_EXIST"])
🔗See Also
getenvsetenvunsetenv
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub