getenv
Get the value of an environment variable.
📝Syntax
s = getenv(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
s string scalar, character vector, string array, cell array of character vectors: the environment variable value.
📄Description

getenv returns the value of an environment variable if it exists.

If the environment variable does not exist, it will return ''.

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

If env_name is a string scalar, then s is a character vector.

💡Examples
getenv('OS')
getenv('myenvvar')
getenv(["PATH"; "OS"])
getenv({'PATH'; 'OS'})
🔗See Also
setenvsearchenv
🕔Version History
Version Description
1.0.0 initial version
1.4.0 Retrieve the values of several environment variables.
Edit this page on GitHub