Main Content

importFromDocument

Class: slreq.ReqSet
Package: 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

Requirements 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'

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

Example: 'ReqSet', 'My_Requirements_Set'

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

Example: 'RichText', true

Option to import requirements content using user-defined bookmarks. This value is true by default for Microsoft® Word documents and false by default for Microsoft Excel® spreadsheets.

Example: 'bookmarks', false

Regular expression pattern for ID search in Microsoft Office documents.

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

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 specified for import using the 'columns' argument.

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

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

Example: 'columns', [1 6]

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

Example: 'rows', [3 35]

Column in the Microsoft Excel spreadsheet that you want to correspond to the ID field in your requirement set, specified as a double.

Example: 'idColumn', 1

Column in the Microsoft Excel spreadsheet that you want to correspond to the Summary field in your requirement set, specified as a double.

Example: 'summaryColumn', 4

Column in the Microsoft Excel spreadsheet that you want to correspond to the Keywords field in your requirement set, specified as a double.

Example: 'keywordsColumn', 3

Column in the Microsoft Excel spreadsheet that you want to correspond to the Description field in your requirement set, specified as a double.

Example: 'descriptionColumn', 2

Column in the Microsoft Excel spreadsheet that you want to correspond to the Rationale field in your requirement set, specified as a double.

Example: 'rationaleColumn', 5

Column in the Microsoft Excel spreadsheet that you want to correspond to the Custom Attributes field in your requirement set, specified as a double.

Example: 'attributeColumn', 6

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 requirements 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.

Introduced in R2018a