Search code examples
matlabibm-doors

How to export enumerated list values from DOORS into cells or fields of MATLAB data


Here's the situation. I have an attribute in a DOORS module which allows multiple values of an enumeration list to be selected. If I export the DOORS module to an Excel workbook and the enumeration values will appear on separate lines in an Excel cell. If I export to a CSV file, each enumeration collection is surrounded with quote-marks; each enum value followed with a CR-LF .

If I try to import the CSV into MATLAB with readtable , the import fails because some rows in the CSV file are not "full-length" because the corresponding objects in DOORS had empty values for some attributes. If I import from the Excel worksheet, I can get all the data, but all the enumeration values are "crushed" into a single string. The line-break chars are lost and there's no way to separate the individual enumeration strings.

The reason I'm trying to do all this is that I'd like to have an automated way of dumping all the values in the underlying EnumerationType in DOORS into a cell array in MATLAB for subsequent matching and processing. I'm trying to avoid having to write (and then distribute to coworkers) a DXL script which collects the individual enumeration values and writes them to an output file -- which among other things separates the enum output from the general export of information from other attributes. (and probably would make importing to MATLAB painful).

So: any ideas? Export/import options I've missed that might help?

Here's an example of the output CSV format. Everything contained between a pair of '"' comprises one object's enumeration attribute value set. The first row contains the header labels.

ID,Type,ReqStatus,_ApprovalList,_ApprovedBy
PF_SYS_RC_2436,Functional Requirement,Init,Soe Jivak,
PF_SYS_RC_2082,Non-Functional Requirement,In Review,"Soe Jivak
Lord Tyrion
Jon Snow
Larry
Moe
Curly
Groucho
Harpo
Beppo","Lord Tyrion
Larry
Moe"
PF_SYS_RC_2083,Non-Functional Requirement,In Review,"Jon Snow
Larry
Moe",Larry
PF_SYS_RC_2084,Non-Functional Requirement,In Review,Groucho,
PF_SYS_RC_2088,Non-Functional Requirement,In Review,"Lord Tyrion
Moe
Groucho",Moe

Solution

  • Here's an approach that will work, albeit with some string-matching and regexp work required after importing into MATLAB.

    1. export the DOORS module to a plain text file. yeah, sorry about Unicode :-(

    2. import using the parameters readtable('filename.txt','delimiter',':','readvariablenames',false); This is because the attribute names are separated from the attribute values with a colon. The result is a table with two columns, Var1 and Var2.
    3. Separate out attribute contents by attribute name -- basically collecting indices for each name via find or equivalent.
    4. As desired, split each enumeration list into cell arrays. These lists are comma-separated values within each string in the cells of "Var2".

    Here's what the MATLAB "Variables" window shows for the example data provided in the question. (sorry, I can't see how to space into two obvious columns)

    ' Type' 'Functional Requirement'
    'Absolute Number' '2436'
    'ReqStatus' 'Init'
    '_ApprovedBy' ''
    '_ApprovalList' 'Soe Jivak'
    '_Reviewer' ''
    '_PeerReview' ''
    'Type' 'Non-Functional Requirement'
    'Absolute Number' '2082'
    'ReqStatus' 'In Review'
    '_ApprovedBy' 'Lord Tyrion, Larry, Moe'
    '_ApprovalList' 'Soe Jivak, Lord Tyrion, Jon Snow, Larry, Moe, Curly, Groucho, Harpo, Beppo'
    '_Reviewer' ''
    '_PeerReview' 'Peer Reviewed'
    'Type' 'Non-Functional Requirement'