MATLAB Function Reference    
matlabroot

Return root directory of MATLAB installation

Syntax

Description

matlabroot returns the name of the directory in which the MATLAB software is installed. In compiled M-code, it returns the path to the executable. Use matlabroot to create a path to MATLAB and toolbox directories that does not depend on a specific platform or MATLAB version.

rd = matlabroot returns the name of the directory in which the MATLAB software is installed and assigns it to rd.

Examples

fullfile(matlabroot,'toolbox','matlab','general')

produces a full path to the toolbox/matlab/general directory that is correct for the platform it is executed on.

See Also

fullfile, partialpath, path


  matlabrc max