Main Content

slreq.convertAnnotation

Convert annotations to requirement objects

Description

myReq = slreq.convertAnnotation(myAnnotation,myDestination) converts a Simulink® or a Stateflow® annotation myAnnotation into a requirement myReq and stores it in a destination entity myDestination.

myReq = slreq.convertAnnotation(myAnnotation,myDestination,Name,Value) converts a Simulink or a Stateflow annotation myAnnotation into a requirement myReq and stores it in a destination entity myDestination using additional options specified by one or more Name, Value pair arguments.

Examples

Convert Simulink Annotation to Requirement

% Find all annotations in a Simulink model
allAnnotations = find_system('controller_Model', 'FindAll', ...
'on', 'type', 'annotation');

% Create a new requirements set
newReqSet = slreq.new('myNewReqSet');

% Convert one annotation into a requirement newReq
% and add it to newReqSet
newReq = slreq.convertAnnotation(allAnnotations(1), ...
newReqSet);

Input Arguments

collapse all

The annotation to be converted, specified as a Simulink.Annotation object.

The destination entity for the converted annotation, specified either as an slreq.Requirement or as an slreq.ReqSet object.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'CreateLinks', true

Option to create links when converting annotations, specified as a Boolean value.

Option to retain the annotation after conversion, specified as a Boolean value.

Option to specify annotation conversion even if a callback function is specified in the annotation, specified as a Boolean value.

Option to display the Requirement markup after annotation conversion, specified as a Boolean value.

Output Arguments

collapse all

The converted annotation, returned as an slreq.Requirement object.

Introduced in R2018a