Skip to content
This repository was archived by the owner on Feb 11, 2026. It is now read-only.

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

matlab-pkg-install

Important

This project is deprecated. MATLAB's now includes package management capabilities as of R2024b.

A simple package for automating adding MATLAB packages/folders to the MATLAB search path on startup.

Third-party code downloaded from the MathWorks MATLAB File Exchange can be added to MATLAB's search path automatically by using an addpath command in your startup.m file in your userpath. While simple, it can be annoying to do for each subsequent package that you download (or even create yourself). This utility automates the addition of useful packages to the MATLAB search path with a simple function and offers the option to create one-off installation scripts for packages you intend to share with others. If you would like third-party/self-written code to be instantly available from the MATLAB command line, then this might be a helpful tool for you.

You can also find this code on the MATLAB File Exchange.

Usage

Begin by "installing" this package to enable its global use with other packages:

  1. Navigate to this package's directory in MATLAB.
  2. Run the install.m script.

Other packages can now be installed by using the pkg_install function:

  1. Determine the path to your new package.
  2. In MATLAB, use pkg_install('PATH_TO_PACKAGE') to add the new package to the search path and append the same search path addition command to your startup.m file. If no startup.m file is found at userpath, one will be created for you. Be careful when editing the startup.m file in the future, as removing the addpath entries appended by this utility will render it useless.

If you have a MATLAB package that you would like to create an install script for...

  1. Navigate to your package's directory in MATLAB.
  2. Use create_install_script('PACKAGE_NAME') to create a simple, portable installation script for your code. Said script will perform the same operations as this utility's pkg_install function, but might be useful for users who are not aware/do not use it.

Other Helpful Tools

This utility is very simple. If you would like a more fully-featured tool that allows for MATLAB package management similar to pip for Python or npm for Node.js, check out Omid Sani's PackMan. PackMan takes dependency management and organization a few steps further than the code in this repository by implementing package installation from internet sources (e.g. GitHub) and integrated version control. The accompanying blog post helpfully explains what PackMan has to offer and how to use it.

About

A simple package for automating adding MATLAB packages/folders to the MATLAB search path on startup.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages