This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Root folder for specified toolbox


s = toolboxdir('tbxFolderName')
s = toolboxdir tbxFolderName


toolboxdir('tbxFolderName') returns a character vector containing the absolute path to the specified toolbox, tbxFolderName, where tbxFolderName is the folder name for the toolbox.

s = toolboxdir('tbxFolderName') returns the absolute path to the specified toolbox to the output argument, s.

s = toolboxdir tbxFolderName is the command form of the syntax.


Obtain the path for the Control System Toolbox™ software:

s = toolboxdir('control')

MATLAB® returns:

s = C:\Program Files\MATLAB\R2012a\toolbox\control


toolboxdir is particularly useful for MATLAB Compiler™ software. The base folder of all toolboxes installed with MATLAB software is:


However, in deployed mode, the base folders of the toolboxes are different. toolboxdir returns the correct root folder, whether running from MATLAB or from an application deployed with the MATLAB Compiler software.

To determine the folder name for a given toolbox, run the following code, substituting the name of a product function for toolbxfcn:

n = 'toolbxfcn';
pat = '(?<=^.+[\\/]toolbox[\\/])[^\\/]+';
regexp(which(n), pat, 'match', 'once')

For example, to determine the product name for Control System Toolbox set n to the name of a function unique to Control System Toolbox, such as dss:

n = 'dss'
pat = '(?<=^.+[\\/]toolbox[\\/])[^\\/]+'
regexp(which(n), pat, 'match', 'once')

Introduced in R2006a

Was this topic helpful?