Main Content

createReferences

Class: slreq.ReqSet
Namespace: slreq

Create read-only references to requirement items in third-party documents

Syntax

createReferences(rs, pathToFile, Name, Value)
createReferences(rs, reqFormat, Name, Value)

Description

createReferences(rs, pathToFile, Name, Value) creates read-only references to requirements content in an external document at pathToFile by using additional Name, Value arguments to specify import options.

createReferences(rs, reqFormat, Name, Value) creates read-only references to requirements content in an external document corresponding to the specified registered document type specified by reqFormat by using additional Name, Value arguments to specify import options.

Input Arguments

expand all

Requirement set file, specified as a slreq.ReqSet object.

Path to the requirements document.

Example: 'C:\MATLAB\System_Requirements.docx'

Custom registered document type label that you create by using a Custom Document Type extension API.

Example: 'linktype_rmi_doors'

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'columns', '[1 8]', 'RichText', true

The name of the existing requirement set that you import references to requirements into, specified as the comma-separated pair of 'ReqSet' and a valid requirement set file name.

Example: 'ReqSet', 'My_Requirements_Set'

Option to import requirements content as rich text, specified as the comma-separated pair consisting of 'RichText' and true or false.

Example: 'RichText', true

Option to use custom bookmarks in Microsoft Word documents and Microsoft Excel spreadsheets to import requirements content, specified as the comma-separated pair consisting of 'bookmarks' and true or false.

Example: 'bookmarks', false

Import requirements by using regular expression pattern matching, specified as the comma-separated pair consisting of 'match' and a regular expression pattern.

Example: 'match', '^REQ\d+'

Range of columns to import. This option is applicable only for Microsoft Excel spreadsheets.

Example: 'columns', [1 6]

Range of rows to import. This option is applicable only for Microsoft Excel spreadsheets.

Example: 'rows', [3 35]

Attribute names to import, specified as a cell array.

Note

When importing requirements from a Microsoft Excel spreadsheet, the length of this cell array must match the number of columns that you specified for import by using the 'columns' option.

Example: 'attributes', {'Test Status', 'Test Procedure'}

Column in the Microsoft Excel spreadsheet that you want to correspond to the ID field in the requirement set.

Example: 'idColumn', 1

Column in the Microsoft Excel spreadsheet that you want to correspond to the Summary field in the requirement set.

Example: 'summaryColumn', 4

Column in the Microsoft Excel spreadsheet that you want to correspond to the Keywords field in the requirements set.

Example: 'keywordsColumn', 3

Column in the Microsoft Excel spreadsheet that you want to correspond to the Description field in the requirements set.

Example: 'descriptionColumn', 2

Column in the Microsoft Excel spreadsheet that you want to correspond to the Rationale field in the requirements set.

Example: 'rationaleColumn', 5

Examples

Create Read-Only References to Requirements in Microsoft Office Documents

% Create a new requirement set and save it

rs = slreq.new('newReqSet');
save(rs);

% Create read-only rich text references to requirements 
% in a Word document
createReferences(rs, 'C:\Work\Requirements_Spec.docx', ...
'RichText', true);

% Create read-only plain text references to requirements 
% in an Excel spreadsheet
createReferences(rs, 'C:\Work\Design_Spec.xlsx', ...
'columns', [2 6], 'rows', [3 32], 'idColumn', 2, ...
'summaryColumn', 3);

Version History

Introduced in R2018a