Loading libraries

mathlayer® can read m-files for scripts and functions. For these files to be visible to mathlayer®, they must be located in the search path or in the current working directory.

The search path is to be understood a group of directories where mathlayer® looks for available m-files (having a .m extension).

To know which directories have been added to the search path you can use path function as follows:

>> path#

C:\mathlayer\beta-win64-cmd\mathlayer-cmd\libs\chart\
C:\mathlayer\beta-win64-cmd\mathlayer-cmd\libs\optimization\
C:\mathlayer\beta-win64-cmd\mathlayer-cmd\libs\optimization\nsga2\
C:\mathlayer\beta-win64-cmd\mathlayer-cmd\libs\statistics\

When there are files with the same name in different folders, the file located in the first folder by ASCII-code order will be taken (the order in which are displayed when running path#).

Adding a folder to the search path

Use the function path to add more directories to the search path.

>> path('C:\mathlayer\beta-win64-cmd\mathlayer-cmd\mfiles')

[ans:1x64 char]

>> path#

C:\mathlayer\beta-win64-cmd\mathlayer-cmd\libs\chart\
C:\mathlayer\beta-win64-cmd\mathlayer-cmd\libs\optimization\
C:\mathlayer\beta-win64-cmd\mathlayer-cmd\libs\optimization\nsga2\
C:\mathlayer\beta-win64-cmd\mathlayer-cmd\libs\statistics\
C:\mathlayer\beta-win64-cmd\mathlayer-cmd\mfiles

Removing a folder from the search path

In order to remove a folder from the search path you can use the function rmpath as follows

>> rmpath('C:\mathlayer\beta-win64-cmd\mathlayer-cmd\libs\chart\')

[ans:1x73 char]

>> path#

C:\mathlayer\beta-win64-cmd\mathlayer-cmd\libs\optimization\
C:\mathlayer\beta-win64-cmd\mathlayer-cmd\libs\optimization\nsga2\
C:\mathlayer\beta-win64-cmd\mathlayer-cmd\libs\statistics\
C:\mathlayer\beta-win64-cmd\mathlayer-cmd\mfiles

Related functions

path | rmpath