Main Content

getenv

Environment variable

Description

example

value= getenv(name)searches the operating system environment variable list for text of the formname=value.

On UNIX®platforms, the shell you use to start MATLAB®determines the operating system environment. For example, starting MATLAB on aMacplatform from theApplicationsfolder creates a different shell environment from starting MATLAB from Terminal.

Examples

collapse all

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

Input Arguments

collapse all

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

Example:'PATH'

Output Arguments

collapse all

Environment variable value, returned as a character vector. Ifnameis not found, then MATLAB returns an empty matrix.

Extended Capabilities

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

Version History

Introduced before R2006a