Requirements Manager: How to extract information from the Custom Attribute Registry inside the Requirement Set class

5 次查看(过去 30 天)
Hi all,
I have reached a good level of export requirements in the exel format using the guide indicated to me by the Matlab community: https://www.mathworks.com/help/slrequirements/ug/export-requirements-and-link-information-example.html
Now I would like to enrich the export by including the custom requirements. The method slreq.open('Name.slreqx') return me the requirement set structure but using the slreq.find() the custom attribute is not included. How can I achieve this, if it is possible? Thanks
Attached an image to show my sysReqSeqSet structure after running slreq.open('Req_TestMod_v2.slreqx') with two custom attributes added 'CustomAttributeNames', that I would like to export to the exel file along with the others.
Thank you in advance.

采纳的回答

Pat Canny
Pat Canny 2024-6-20
You can get an array of CustomAttributeNames as a property of a Requirement Set, then use inspectAttribute to query the Information for a given Custom Attribute.
Here is a quick example leveraging the example from the inspectAttribute page in our documentation:
slreq.load('crs_req_func_spec');
rs = slreq.find('Type','ReqSet');
addAttribute(rs,'MyCheckbox','Checkbox','Description',...
'This checkbox attribute can be true or false.');
addAttribute(rs,'MyEdit','Edit','Description',...
'This is an Edit field');
customAttributeNames = string(rs.CustomAttributeNames)';
customAttributeInfo = arrayfun(@(x) string(inspectAttribute(rs,customAttributeNames(x)).description), 1:numel(customAttributeNames))';
tableForExport = table(customAttributeNames,customAttributeInfo,'VariableNames',["Custom Attribute", "Info"])
From here you can use writetable to export to Excel.
  1 个评论
Luca
Luca 2024-6-21
Thank you Pat, I understand your example that will be useful to me. I have to apologize though, I couldn't explain myself and focus on what I needed.
The canonical (slreq.Requirement) array structure of properties created within the reqXlsExport.m script through the slreq.find('Type','Requirement'); obviously not contain the fields of the my new custom requirements (requirement by requirement). Now i would to figure out how to extract the data associated to the my custom requirements values (requirement by requirement) if it is possible. After that i'll exported in the exel file, but this is another story. I hope I've explained myself better. Thank You.

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by