Main Content

mpmAddRepository

Add repository to repository list

Since R2024b

    Description

    mpmAddRepository(repoName,repoLocation) adds the specified location to the MATLAB® repository list and gives the repository the specified name.

    The function adds repositories to the end of the MATLAB repository list by default. If a specified repository is already on the repository list, then the function moves the repository to the end of the list.

    example

    mpmAddRepository(repoObj) adds the specified matlab.mpm.Repository object to the list of known repositories.

    mpmAddRepository(___,Position=repoPos) adds the repository to the repository list at the specified position. Specify repoPos as "begin" or "end" in addition to any of the input argument combinations in previous syntaxes.

    If a specified repository is already on the repository list, then the function moves the repository to the specified position.

    example

    repo = mpmAddRepository(___) returns a matlab.mpm.Repository object that represents the added repository.

    Examples

    collapse all

    Add the folder C:\MyCode\MyPackageRepository to the repository list and name it "My Repository".

    mpmAddRepository("My Repository","C:\MyCode\MyPackageRepository")

    Add the folder C:\MyCode\MyPackageRepository to the beginning of the repository list.

    repo = mpmAddRepository("MyRepo","C:\MyCode\MyPackageRepository",Position="beginning")
    repo = 
    
      Repository with properties:
    
            Name: "MyRepo"
        Location: "C:\MyCode\MyPackageRepository"

    Input Arguments

    collapse all

    Repository name, specified as a string array, character vector, or cell array of character vectors.

    Repository location, specified as a string array, character vector, or cell array of character vectors where each element contains the location to be added to the MATLAB repository list.

    Repository object, specified as a matlab.mpm.Repository array.

    Repository list position, specified as one of these values:

    • "end" — Add the repository to the end of the repository list.

    • "begin" — Add the repository to the beginning of the repository list.

    Tips

    • It is recommended to make sure a package's Authoring property is 0 or false before adding the folder containing that package as a repository.

    Version History

    Introduced in R2024b