matlabroot

Returns the folder where the program is installed.

Category: Programming > Files and Folders

Syntax

r = matlabroot

Returns the installation root as a character vector.

Description

matlabroot is the base for locating files that ship with the program, as in fullfile(matlabroot, 'toolbox'). The value depends on the machine, so scripts should not print it or rely on a fixed path.

Output arguments

r
Path of the installation folder.

Example

Checking the root

r = matlabroot;
ischar(r)
isfolder(r)
Output
ans = logical
   1
ans = logical
   1

Notes

In MatLivre the root is the folder that contains the running program.

See also

toolboxdir userpath fullfile path