Main Content

importFromDocument

Class: slreq.ReqSet
Namespace: slreq

Import editable requirements from external documents

Syntax

importFromDocument(rs, pathToFile, Name,Value)

Description

importFromDocument(rs, pathToFile, Name,Value) imports editable requirements with contents duplicated from an external document at pathToFile using by 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 that you want to import editable requirements from.

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

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: 'ReqSet','design_specs.slreqx'

Option to import requirements as referenced requirements, specified as a Boolean value.

To continue to manage the requirements in a third-party tool, import the requirements as referenced requirements by setting the value to true or using the default value. To migrate the requirements to Requirements Toolbox™, import the requirements as slreq.Requirement objects by setting the value to false. For more information, see Select an Import Mode.

Import from ReqIF format, specifying the attribute mapping as a comma-separated pair consisting of 'attr2reqprop' and a containers.Map object. For example:

attrMap = containers.Map('KeyType','char','ValueType','char')
attrMap('SourceID') = 'Custom ID'; % Built-in attribute
attrMap('ReqIF.ChapterName') = 'Summary'; % Built-in attribute
attrMap('Data Class') = 'MyDataClass'; % Custom attribute

slreq.import('myfile.reqif','attr2reqprop',attrMap);

Example: slreq.import('myfile.reqif','attr2reqprop',attrMap);

Column in the Microsoft® Excel® spreadsheet that you want to map as custom attributes of the requirements in your requirement set, specified as a double array.

Example: 'attributeColumn',[4 6]

Attribute names for custom attribute columns, specified as a cell array of character vectors.

Note

When importing requirements from a Microsoft Excel spreadsheet, the length of this cell array must match the number of columns specified for import using the attributeColumn argument.

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

Option to import requirements content using user-defined bookmarks, specified as a 1 or 0 of data type logical.

By default, Requirements Toolbox sets the value to 1 for Microsoft Word documents and 0 for Microsoft Excel spreadsheets.

Example: 'bookmarks',false

Range of columns to import from Microsoft Excel spreadsheet, specified as a double array.

Example: 'columns',[1 6]

Column in the Microsoft Excel spreadsheet that you want to map to the CreatedBy property of the requirements in your requirement set, specified as a double.

Example: 'createdByColumn',5

Column in the Microsoft Excel spreadsheet that you want to map to the Description property of the requirements in your requirement set, specified as a double.

Example: 'descriptionColumn',2

Column in the Microsoft Excel spreadsheet that you want to map to the ID property of the requirements in your requirement set, specified as a double.

Example: 'idColumn',1

Option to import links when importing requirements from ReqIF files, specified as a Boolean value.

Example: importLinks=true

Name of the attribute from the external document that you want to map to the Keywords property for the imported requirements.

Use this argument when you import from IBM® DOORS® or custom document types.

Example: "keywords","Requirement Keywords"

Column in the Microsoft Excel spreadsheet that you want to map to the Keywords property of the requirements in your requirement set, specified as a double.

Example: 'keywordsColumn',3

Regular expression pattern for ID search in Microsoft Office documents.

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

Column in the Microsoft Excel spreadsheet that you want to map to the ModifiedBy property of the requirements in your requirement set, specified as a double.

Example: 'modifiedByColumn',6

Custom post-import callback script name to use during import, specified as a string scalar or character vector.

The script that you assign to this callback executes after you import or update requirements.

Example: "postImportFcn","myPostImportScript"

Custom pre-import callback script name to use during import, specified as a string scalar or character vector.

The script that you assign to this callback executes before you import or update requirements.

Example: "preImportFcn","myPreImportScript"

Name of profile to use when importing requirements and links from ReqIF files, specified as a string scalar or character vector.

If a profile with this name does not exist, the software creates it and assigns it to the imported requirement set and link set. If a profile with this name exists, the software assigns it to the imported requirement set and link set.

Example: profile="myProfile"

Name of the profile mapping file to use when importing requirements and links from ReqIF files, specified as a string scalar or character vector.

The profile mapping XML file specifies how ReqIF requirement and link types and attributes map to Requirements Toolbox stereotypes and stereotype properties. To use this argument, you must also specify the profile to assign to the imported requirement set and link set by using the profile argument.

Tip

You can create a profile mapping file from a requirement set that has a profile mapping by using the saveProfileMapping method.

Example: profileMapping="myMapping.xml"

Name of the attribute from the external document that you want to map to the Rationale property for the imported requirements.

Use this argument when you import from IBM DOORS or custom document types.

Example: "rationale","Requirement Rationale"

Column in the Microsoft Excel spreadsheet that you want to map to the Rationale property of the requirements in your requirement set, specified as a double.

Example: 'rationaleColumn',5

The name for the requirement set that you import requirements into, specified as a character vector.

If the requirement set exists, the requirements import under a new Import node. If the requirement set does not exist, Requirements Toolbox creates it.

Example: 'ReqSet','My_Requirements_Set'

Option to import requirements as rich text, specified as a Boolean value.

Example: 'RichText',true

Range of rows to import from Microsoft Excel spreadsheet, specified as a double array.

Example: 'rows',[3 35]

Worksheet name from Microsoft Excel workbook, specified as a character vector.

Example: 'sheet','Sheet1'

Column in the Microsoft Excel spreadsheet that you want to map to the Summary property of the requirements in your requirement set, specified as a double.

Example: 'summaryColumn',4

Import from Microsoft Excel spreadsheets specified in the USDM (Universal Specification Describing Manner) standard format. Specify values as a character vector with the ID prefix optionally followed by a separator character.

Example: 'RQ -' will match entries with IDs similar to RQ01, RQ01-2, RQ01-2-1 etc.

Examples

Import Editable Requirements from Microsoft Office Documents

% Create a new requirement set and save it
rs = slreq.new('newReqSet');
save(rs);

% Import editable requirements as rich text from a Word document
importFromDocument(rs, 'C:\Work\Requirements_Spec.docx', ...
 'RichText', true);

% Import editable requirements from an Excel spreadsheet
importFromDocument(rs, 'C:\Work\Design_Spec.xlsx', ... 
'columns', [2 6], 'rows', [3 32], 'idColumn', 2, ...
'summaryColumn', 3);
For more information on importing requirements from Microsoft Office documents, see Import Requirements from Microsoft Office Documents.

Version History

Introduced in R2018a