toolboxdir

Returns the folder of a toolbox.

Category: Programming > Files and Folders

Syntax

d = toolboxdir(toolboxname)

Returns the root folder of the named toolbox.

Description

toolboxdir locates the files of a toolbox without hard-coding where the program was installed. It is the toolbox counterpart of matlabroot. The value depends on the machine, so use it to build paths and not as output.

Input arguments

toolboxname
Toolbox folder name as text, such as 'matlab'.

Output arguments

d
Path of the toolbox folder.

Example

Asking for a toolbox folder

d = toolboxdir('matlab');
ischar(d)
Output
ans = logical
   1

Notes

MatLivre knows only a few toolbox folders such as 'matlab'; an unknown name raises the error Could not locate the base directory.

See also

matlabroot fullfile which path