Main Content

slreq.refreshCustomizations

Register Requirements Toolbox customizations

Since R2022a

    Description

    example

    slreq.refreshCustomizations searches the MATLAB® path for sl_customization.m files and registers the requirement type and link type customizations defined in the files.

    Note

    If Simulink® is installed, this function behaves the same as sl_refresh_customizations (Simulink). If Simulink is not installed, this function only registers Requirements Toolbox™ customizations and silently ignores other customizations.

    Examples

    collapse all

    This example shows how to define and register custom requirement types and custom link types by using an sl_customization file.

    Create an sl_customization File

    In MATLAB®, select the Home tab and click New Script. Copy and paste this code in the script.

    function sl_customization(cm)
        cObj = cm.SimulinkRequirementsCustomizer;
    end
    

    Select the Editor tab and click Save. Save the file as sl_customization.m.

    Define Requirements Toolbox Customizations

    Define a custom requirement type called Stakeholder by using the addCustomRequirementType function. Define the custom requirement type as a subtype of the built-in Functional type, then provide a description for the custom requirement type. Copy and paste this code in the sl_customization file.

    addCustomRequirementType(cObj,"Stakeholder",slreq.custom.RequirementType.Functional,...
        "Stakeholder functional requirements");
    

    Define a custom link type as a subtype of the built-in Relate type called Trace by using the addCustomLinkType function. Define the forward and backward link direction as Traces and Traced from, respectively, then provide a description for the custom link type. Copy and paste this code in the sl_customization file and click Save.

    addCustomLinkType(cObj,"Trace",slreq.custom.LinkType.Relate,"Traces",...
        "Traced from","General purpose link type from requirement to other item.");
    

    Register the Requirements Toolbox Customizations

    The updated sl_customization file defines the requirement type and link type customizations.

    type sl_customization
    function sl_customization(cm)
        cObj = cm.SimulinkRequirementsCustomizer;
        addCustomRequirementType(cObj,"Stakeholder",slreq.custom.RequirementType.Functional,...
        "Stakeholder functional requirements");
        addCustomLinkType(cObj,"Trace",slreq.custom.LinkType.Relate,"Traces",...
        "Traced from","General purpose link type from requirement to other item.");
    end
    

    Register the Requirements Toolbox customizations.

    slreq.refreshCustomizations

    View Customizations in the Requirements Editor

    Open the basicReqSet requirement set in the Requirements Editor.

    slreq.open("basicReqSet");

    In the Requirements Editor, click Show Requirements and then select the requirement with index 1. In the right pane, under Properties, in the Type menu, select Stakeholder from the list.

    stakeholder.png

    Click Show Links and select link #1. In the right pane, under Properties, in the Type menu, select Traces from the list.

    traces.png

    Version History

    Introduced in R2022a