importFromDocument
Class: slreq.ReqSet
Namespace: slreq
Import editable requirements from external documents
Syntax
importFromDocument(rs, pathToFile, Name,Value)
Description
importFromDocument(
imports editable requirements with contents duplicated from an external document at
rs
, pathToFile
, Name,Value
)pathToFile
using by additional Name,Value
arguments to specify import options.
Input Arguments
rs
— Requirement set file
slreq.ReqSet
object
Requirement set file, specified as a slreq.ReqSet
object.
pathToFile
— File path
character vector
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'
AsReference
— Option to import as referenced requirements
true
(default) | false
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.
attr2reqprop
— ReqIF™ attribute mapping
containers.Map
object
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);
attributeColumn
— Custom Attributes Column
double
array
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]
attributes
— Attribute names
cell array
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'}
bookmarks
— Option to import requirements using bookmarks
0
(default) | 1
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
columns
— Range of columns
double
array
Range of columns to import from Microsoft
Excel spreadsheet, specified as a double
array.
Example: 'columns',[1 6]
createdByColumn
— Created By Column
double
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
descriptionColumn
— Description Column
double
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
idColumn
— ID Column
double
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
importLinks
— Option to import links
false
(default) | true
Option to import links when importing requirements from ReqIF files, specified as a Boolean value.
Example: importLinks=true
keywords
— Attribute to map to Keywords
string scalar | character vector
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"
keywordsColumn
— Keywords Column
double
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
match
— Regular expression pattern
character vector
Regular expression pattern for ID search in Microsoft Office documents.
Example: 'match','^REQ\d+'
modifiedByColumn
— Modified By Column
double
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
postImportFcn
— Custom post-import callback
string scalar | character vector
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"
preImportFcn
— Custom pre-import callback
string scalar | character vector
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"
profile
— Name of profile
string scalar | character vector
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"
profileMapping
— Name of profile mapping file
string scalar | character vector
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"
rationale
— Attribute to map to Rationale
string scalar | character vector
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"
rationaleColumn
— Rationale Column
double
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
ReqSet
— Requirement Set
character vector
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'
RichText
— Option to import rich text requirements
false
(default) | true
Option to import requirements as rich text, specified as a Boolean value.
Example: 'RichText',true
rows
— Range of rows
double
array
Range of rows to import from Microsoft
Excel spreadsheet, specified as a double
array.
Example: 'rows',[3 35]
sheet
— Worksheet name
character vector
Worksheet name from Microsoft Excel workbook, specified as a character vector.
Example: 'sheet','Sheet1'
summaryColumn
— Summary Column
double
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
USDM
— USDM Format Import Option
character vector
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);
Version History
Introduced in R2018a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)