Main Content

getenv

Environment variable

Description

example

val = getenv(name) returns the value of the operating system environment variable name as a character vector. If name does not exist, then getenv returns an empty character vector.

On UNIX® platforms, the shell you use to start MATLAB® determines the operating system environment. For example, on a Mac platform, starting MATLAB from the Applications folder creates an environment that is different from that created by starting MATLAB from Terminal.

Examples

collapse all

res = getenv("SYSTEMROOT")
res = 'C:\windows'

Input Arguments

collapse all

Environment variable name, specified as a string scalar or character vector.

Example: "PATH"

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a

See Also

| | | | | |