# rehashUnitDBs

Refresh unit database files on MATLAB path

## Syntax

rehashUnitDBs

## Description

example

rehashUnitDBs refreshes unit database files on the MATLAB® path. To load a custom unit database, use this function in conjunction with the createCustomDBFromExcel function.The rehashUnitDBs function:Clears all previously loaded custom units in memory.Resets the set of supported units to the built-in set of units.Looks for database files with the extension .slunitdb.mldtax on the MATLAB path and loads those databases.Issues warnings if units with the same names are loaded. If units have several definitions with the same name in different databases, by default the function tries to use the definition in a built-in units databases. If the unit is not defined in a built-in database, the function uses the definition in the database highest on the MATLAB path.To see the supported spreadsheet format, see Custom Units Spreadsheet Format.

## Examples

collapse all

Create a custom units database file from custom Excel® spreadsheet file, unitsDB.xlsx.

Create a Excel spreadsheet containing these columns and data in any order:

• name, containing ounce_force

• symbol, containing ozf

• asciiSymbol, containing ozf

• displayName, containing {\rm{}oz_{force}}

• definitionExpression, containing oz*gn

• conversionFactor, containing 1

• conversionOffset, containing 0

• physicalQuantity, containing force

Save the database file, for example unitsDB.xlsx .

Create the database.

createCustomDBFromExcel('unitsDB.xlsx')

The function creates unitsDB.slunitdb.mldatx in the current folder.

Add the current folder to the MATLAB path.

addpath C:\work\custom_units

Load the new units database into memory.

rehashUnitDBs