Root folder
matlabroot
mr = matlabroot
matlabroot
returns the name
of the folder where the MATLAB® software is installed. Use matlabroot
to
create a path to MATLAB and toolbox folders that does not depend
on a specific platform, MATLAB version, or installation location.
mr = matlabroot
returns
the name of the folder in which the MATLAB software is installed
and assigns it to mr
.
Get the location where MATLAB is installed:
matlabroot
MATLAB returns:
C:\Program Files\MATLAB\R2009a
Produce a full path to the toolbox/matlab/general
folder
that is correct for the platform on which it is executed:
fullfile(matlabroot,'toolbox','matlab','general')
Change the current folder to the MATLAB root folder:
cd(matlabroot)
To add the folder myfiles
to the MATLAB search
path, run
addpath([matlabroot '/toolbox/local/myfiles'])
fullfile
| path
| toolboxdir