A simple package manager for Matlab (inspired by pip). Downloads packages from Matlab Central's File Exchange, GitHub repositories, or any other url pointing to a .zip file.
Download/clone this repo and add it to your Matlab path (using addpath
). Now try the following:
mpm install [package-name]
: install package by namempm uninstall [package-name]
: remove package, if installedmpm search [package-name]
: search for package given name (checks Github and Matlab File Exchange)mpm freeze
: lists all packages currently installedmpm init
: adds all installed packages to path (run when Matlab starts up)
Install (searches FileExchange and Github):
>> mpm install export_fig
Install a particular Github release (by tag)
>> mpm install matlab2tikz -t 1.0.0
Uninstall
>> mpm uninstall matlab2tikz
Search without installing:
>> mpm search export_fig
Install from a url:
>> mpm install export_fig -u https://www.mathworks.com/matlabcentral/fileexchange/23629-export-fig
OR:
>> mpm install export_fig -u https://github.com/altmany/export_fig.git
(Note that when specifying Github repo urls you must add the '.git' to the url.)
Overwrite existing packages:
>> mpm install matlab2tikz --force
Install/uninstall packages in a specific directory:
>> mpm install matlab2tikz -d /Users/mobeets/mypath
Note that the default installation directory ismpm-packages/
.
>> mpm install -i /Users/mobeets/example/requirements.txt
Specifying a requirements file lets you install or search for multiple packages at once. See 'requirements-example.txt' for an example. Make sure to provide an absolute path to the file!
By default, mpm tries to find the best folder in the package to add to your Matlab path. To install a package without modifying any paths, set --nopaths
.
By default, mpm installs all Matlab packages to the directory mpm-packages/
. (You can edit mpm_config.m
to specify a custom default installation directory.)
If you restart Matlab, you'll want to run mpm init
to re-add all the folders in the installation directory to your Matlab path. Better yet, just run mpm init
from your Matlab startup script.
Because there's no standard directory structure for a Matlab package, automatically adding paths can get a bit messy. When mpm downloads a package, it adds a single folder within that package to your Matlab path. If there are no *.m
files in the package's base directory, it looks in folders called 'bin', 'src', 'lib', or 'code' instead. You can specify the name of an internal directory by passing in an -n
or internaldir
argument.
Mpm keeps track of the packages it's downloaded in a file called mpm.mat
, within each installation directory.