Main Content

slreq.map

Get or set path to link set file

    Description

    example

    slreq.map(source,linkSet) associates the link set linkSet with the source artifact source.

    example

    linkSetFilePath = slreq.map(source) returns the link set path for the source artifact source.

    example

    slreq.map(source,"undo") reverts the mapping to the previously stored mapping for the source artifact source.

    example

    slreq.map(source,"clear") clears the previously stored mappings for the source artifact source.

    Examples

    collapse all

    This example shows how to map a link set file to a model, clear the link set mapping, and map a new link set to the model.

    Define the source artifact and link set.

    source = fullfile(pwd,"slvnvdemo_powerwindowController.slx");

    Review the file path for the mapped link set.

    linkSet = slreq.map(source)
    linkSet = 
    'C:\Users\jdoe\MATLAB\Examples\slrequirements-ex26775930\slvnvdemo_powerwindowRequirements.slmx'
    

    Define a new link set and map the model to the link set.

    newLinkSet = fullfile(pwd, "slvnvdemo_powerwindowRequirements.slmx");
    slreq.map(source, newLinkSet);

    Clear all existing mappings.

    slreq.map(source,"clear");
    Removing all mapping for ...\slvnvdemo_powerwindowController.slx
    

    This example shows how to map a link set file with MATLAB code and how to revert the mapping.

    Define the source artifact and link set.

    source = fullfile(pwd,"myAdd.m");
    linkSet = fullfile(pwd,"myAddLinks1.slmx");

    Map the source artifact to the link set file.

    slreq.map(source,linkSet);

    Map the source artifact to a new link set file..

    newLinkSet = fullfile(pwd,"myAddLinks2.slmx");
    slreq.map(source,newLinkSet);
    Mapping ...\myAdd.m to ...\myAddLinks2.slmx
    

    Undo the mapping to newLinkSet to revert the mapping to the previous value.

    slreq.map(source,"undo");
    Removing C:\Users\jdoe\MATLAB\Examples\slrequirements-ex69996110\myAddLinks2.slmx for ...\myAdd.m
    
    slreq.map(source)
    ans = 
    'C:\Users\jdoe\MATLAB\Examples\slrequirements-ex69996110\myAddLinks1.slmx'
    

    Input Arguments

    collapse all

    Path of the source artifact file, specified as a string scalar or character vector.

    Data Types: char | string

    Path of the link set file, specified as a string scalar or character vector.

    Data Types: char | string

    Output Arguments

    collapse all

    Full path of the mapped link set file, returned as a character vector.

    More About

    collapse all

    Link Set Mapping

    Requirements Toolbox maps a link set to a design artifact file, such as a Simulink® model, when you associate a link set with the artifact. When you open the artifact, the mapped link sets are loaded.

    Default and Nondefault Link Set Mapping

    The default link set mapping for a Model-Based Design artifact is the link set in the same folder as the source artifact with the name that combines the source artifact name and source artifact extension, separated by a tilde. For example, the link set mapping for myAdd.m is myAdd~m.slmx in the same folder as myAdd.m.

    Use slreq.map to map source artifacts to link set files in a nondefault file location or to map multiple link set files to the same source artifact file. Nondefault mappings are stored in user preferences. Use slreq.map to remap nondefault mappings when you move files or share files with other users.

    Version History

    Introduced in R2018a