文档

getenv

Environment variable

Syntax

getenv 'name'
N = getenv(“名字”)

Description

getenv 'name'searches the underlying operating system environment list for text of the formname=value, wherenameis the input character vector. If found, MATLAB®returns the character vectorvalue. If the specified name cannot be found, an empty matrix is returned.

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

N = getenv(“名字”)returnsvalueto the variableN.

Examples

os = getenv('OS')
os = Windows_NT

Introduced before R2006a

Was this topic helpful?