AsimplepackagemanagerforMatlab(inspiredbypip).DownloadspackagesfromMatlabCentral'sFileExchange,GitHubrepositories,oranyotherurlpointingtoa.zipfile.
QuickstartDownload/clonethisrepoandaddittoyourMatlabpath(usingaddpath).Nowtrythefollowing:
mpminstall[package-name]:installpackagebynamempmuninstall[package-name]:removepackage,ifinstalledmpmsearch[package-name]:searchforpackagegivenname(checksGithubandMatlabFileExchange)mpmfreeze:listsallpackagescurrentlyinstalledmpminit:addsallinstalledpackagestopath(runwhenMatlabstartsup)MoredetailsInstallasinglepackageInstall(searchesFileExchangeandGithub):
>>mpminstallexport_figWheninstalling,mpmchecksforafileinthepackagecalledinstall.m,whichitwillrunafterconfirming(oradd--forcetoauto-confirm).Italsochecksforafilecalledpathlist.mwhichtellsitwhichpaths(ifany)toadd.
InstallaGithubrelease(bytag,branch,orcommit)
Bytag:
>>mpminstallmatlab2tikz-t1.0.0Bybranch:
>>mpminstallmatlab2tikz-tdevelopBycommit:
>>mpminstallmatlab2tikz-tca56d9fUninstall
>>mpmuninstallmatlab2tikzWhenuninstalling,mpmchecksforafileinthepackagecalleduninstall.m,whichitwillrunafterconfirming(oradd--forcetoauto-confirm).
Searchwithoutinstalling:
>>mpmsearchexport_figInstallfromaurl:
>>mpminstallcovidx-uhttps://www.mathworks.com/matlabcentral/fileexchange/76213-covidxOR:
>>mpminstallexport_fig-uhttps://github.com/altmany/export_fig.git(NotethatwhenspecifyingGithubrepourlsyoumustaddthe'.git'totheurl.)
Installlocalpackage:
>>mpminstallmy_package-upath/to/package--localTheabovewillcopypath/to/packageintothedefaultinstalldirectory.Toskipthecopy,add-etotheabovecommand.
Overwriteexistingpackages:
>>mpminstallmatlab2tikz--forceInstall/uninstallpackagesinaspecificdirectory:
>>mpminstallmatlab2tikz-d/Users/mobeets/mypathNotethatthedefaultinstallationdirectoryismpm-packages/.
Environments("Collections")mpmhasrudimentarysupportformanagingcollectionsofpackages.Tospecifywhichcollectiontoacton,use-c[collection_name].Defaultcollectionis"default".
>>mpminstallcbrewer-ctestUsingcollection"test"Collecting'cbrewer'...Foundurl:https://www.mathworks.com/matlabcentral/fileexchange/58350-cbrewer2?download=trueDownloadinghttps://www.mathworks.com/matlabcentral/fileexchange/58350-cbrewer2?download=true...>>mpminit-ctestUsingcollection"test"Addingtopath:/Users/mobeets/code/mpm/mpm-packages/mpm-collections/test/cbrewerAddedpathsfor1package(s).Installingmultiplepackagesfromfile>>mpminstall-i/Users/mobeets/example/requirements.txtSpecifyingarequirementsfileletsyouinstallorsearchformultiplepackagesatonce.See'requirements-example.txt'foranexample.Makesuretoprovideanabsolutepathtothefile!
Toautomaticallyconfirminstallationwithoutbeingprompted,set--approve.Notethatthisisonlyavailablewheninstallingpackagesfromfile.
WhatitdoesBydefault,mpminstallsallMatlabpackagestothedirectorympm-packages/.(Youcaneditmpm_config.mtospecifyacustomdefaultinstallationdirectory.)
IfyourestartMatlab,you'llwanttorunmpminittore-addallthefoldersintheinstallationdirectorytoyourMatlabpath.Betteryet,justrunmpminitfromyourMatlabstartupscript.
TroubleshootingBecausethere'snostandarddirectorystructureforaMatlabpackage,automaticallyaddingpathscangetabitmessy.Whenmpmdownloadsapackage,itaddsasinglefolderwithinthatpackagetoyourMatlabpath.Ifthereareno*.mfilesinthepackage'sbasedirectory,itlooksinfolderscalled'bin','src','lib',or'code'instead.Youcanspecifythenameofaninternaldirectorybypassinginan-norinternaldirargument.Toinstallapackagewithoutmodifyinganypaths,set--nopaths.Ortoaddallsubfoldersinapackagetothepath,set--allpaths.
Mpmkeepstrackofthepackagesit'sdownloadedinafilecalledmpm.mat,withineachinstallationdirectory.
评论