s = getenv(env_name)
| Parameter | Description |
|---|---|
| env_name | string scalar, character vector, string array, cell array of character vectors: environment variable name. |
| Parameter | Description |
|---|---|
| s | string scalar, character vector, string array, cell array of character vectors: the environment variable value. |
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.
getenv('OS')
getenv('myenvvar')
getenv(["PATH"; "OS"])
getenv({'PATH'; 'OS'})
| Version | Description |
|---|---|
| 1.0.0 | initial version |
| 1.4.0 | Retrieve the values of several environment variables. |