Main Content

addDependency

Add dependency to package

Since R2024b

    Description

    addDependency(pkg,dep) adds the packages in dep as dependencies to the package pkg and updates the Dependencies property of the package object. The package pkg must be in editable mode.

    example

    Examples

    collapse all

    Create packages named MyPackage and MyOtherPackage.

    pkg = mpmcreate("MyPackage","C:\MyCode\MyPackage");
    dep = mpmcreate("MyOtherPackage","C:\MyCode\MyOtherPackage");

    Make MyOtherPackage a dependency of MyPackage.

    addDependency(pkg,dep)
    pkg.Dependencies
    ans = 
      Dependency with properties:
    
                   Name: "MyOtherPackage"
           VersionRange: ""
                     ID: "89529df1-1fb9-46a5-8ea3-731edb9ab4f8"
        ResolvedVersion: 1.0.0 (1×1 Version)
    
    

    Input Arguments

    collapse all

    Package, specified as a matlab.mpm.Package object.

    Package dependencies to add, specified as a string array of package specifiers, a matlab.mpm.PackageSpecifier array, a matlab.mpm.Package array, or a matlab.mpm.Dependency array. If you specify a package specifier, then addDependency finds the corresponding package among already installed packages.

    Version History

    Introduced in R2024b